title: Crontab not working from whenever gem
body: <p>My linux server is running a Rails 4 app with Nginx/unicorn.</p>
  
  <p>I am using the Whenever gem to schedule tasks. Everything was working normally until a couple of days ago when the cron jobs appear to have simply stopped running.</p>
  
  <p>This is in my schedule.rb file:</p>
  
  <pre><code>every 5.minutes do
      runner "Video.send_to_wistia", environment: 'production'
  end
  </code></pre>
  
  <p>This is what I see when I run <code>crontab -l</code>:</p>
  
  <pre><code># Begin Whenever generated tasks for: myapp
  0,5,10,15,20,25,30,35,40,45,50,55 * * * * /bin/bash -l -c 'cd /home/myuser/myapp &amp;&amp; bin/rails runner -e production '\''Video.send_to_wistia'\'''
  # End Whenever generated tasks for: myapp
  </code></pre>
  
  <p>I have restarted unicorn. I also made sure to run:</p>
  
  <pre><code>whenever --update-crontab myapp
  </code></pre>
  
  <p>In my video.rb file, which contains the action that <em>should</em> run, I placed some log code:</p>
  
  <pre><code>   def self.send_to_wistia
          logger.debug( "Sending videos to wistia at #{Time.now}" )
          ...
  </code></pre>
  
  <p>I've been watching the logs and nothing appears there.</p>
  
  <p>PS: My first instinct was that maybe the site is running in development mode (which the whenever task is not configured to run in) but this does not seem to be the case, because I see now records going into my production database. </p>
  
  <p><strong>Update:</strong>
  As the user for my app, when I run <code>service cron status</code> I get this: <code>cron: unrecognized service</code>. But I'm not sure if this is checking the user's crontab or the system-wide.</p>
  
  <p><strong>Update2:</strong>
  This is what I see when I run <code>pgrep -l cron</code>:</p>
  
  <pre><code>410 crond
  582 crond
  711 crond
  879 crond
  1021 crond
  1188 crond
  1320 crond
  1404 crond
  1509 crond
  1648 crond
  1805 crond
  1829 crond
  1936 crond
  2090 crond
  2196 crond
  2235 crond
  2388 crond
  2491 crond
  2523 crond
  2673 crond
  2773 crond
  2907 crond
  2971 crond
  3068 crond
  3195 crond
  3256 crond
  3386 crond
  3496 crond
  3554 crond
  3686 crond
  3839 crond
  4041 crond
  4137 crond
  4375 crond
  4453 crond
  4657 crond
  4753 crond
  4991 crond
  5036 crond
  5287 crond
  5335 crond
  5609 crond
  5620 crond
  5891 crond
  5918 crond
  6186 crond
  6203 crond
  6468 crond
  6501 crond
  6781 crond
  6786 crond
  7080 crond
  7084 crond
  7368 crond
  7375 crond
  7658 crond
  7667 crond
  7964 crond
  7965 crond
  8246 crond
  8559 crond
  8647 crond
  8841 crond
  8932 crond
  9136 crond
  9232 crond
  9444 crond
  9515 crond
  9745 crond
  9813 crond
  10097 crond
  10100 crond
  10395 crond
  10539 crond
  10680 crond
  10975 crond
  11029 crond
  11260 crond
  11325 crond
  11559 crond
  11629 crond
  11855 crond
  11936 crond
  12153 crond
  12246 crond
  12438 crond
  12739 crond
  12756 crond
  13038 crond
  13085 crond
  13337 crond
  13380 crond
  13622 crond
  13663 crond
  13920 crond
  14017 crond
  14205 crond
  14301 crond
  14503 crond
  14596 crond
  14788 crond
  14939 crond
  15086 crond
  15260 crond
  15382 crond
  15542 crond
  15680 crond
  15953 crond
  15963 crond
  16253 crond
  16263 crond
  16547 crond
  16548 crond
  16839 crond
  16846 crond
  17130 crond
  17134 crond
  17416 crond
  17430 crond
  17711 crond
  17715 crond
  17993 crond
  18013 crond
  18288 crond
  18298 crond
  18570 crond
  18596 crond
  18865 crond
  18892 crond
  19147 crond
  19190 crond
  19453 crond
  19475 crond
  19735 crond
  19773 crond
  20030 crond
  20058 crond
  20313 crond
  20356 crond
  20608 crond
  20641 crond
  20890 crond
  20939 crond
  21185 crond
  21224 crond
  21467 crond
  21522 crond
  21762 crond
  21807 crond
  22044 crond
  22105 crond
  22339 crond
  22401 crond
  22621 crond
  22699 crond
  22927 crond
  22984 crond
  23209 crond
  23283 crond
  23504 crond
  23568 crond
  23786 crond
  23866 crond
  24081 crond
  24151 crond
  24363 crond
  24449 crond
  24658 crond
  24734 crond
  24940 crond
  25032 crond
  25235 crond
  25317 crond
  25517 crond
  25617 crond
  25812 crond
  25913 crond
  26095 crond
  26211 crond
  26401 crond
  26496 crond
  26683 crond
  26794 crond
  26978 crond
  27079 crond
  27260 crond
  27377 crond
  27555 crond
  27662 crond
  27837 crond
  27960 crond
  28132 crond
  28245 crond
  28414 crond
  28543 crond
  28709 crond
  28828 crond
  28991 crond
  29127 crond
  29296 crond
  29423 crond
  29546 crond
  29721 crond
  29841 crond
  30014 crond
  30136 crond
  30322 crond
  30418 crond
  30733 crond
  30767 crond
  31015 crond
  31071 crond
  31314 crond
  31358 crond
  31596 crond
  31692 crond
  31892 crond
  31983 crond
  32174 crond
  32283 crond
  32469 crond
  32568 crond
  32751 crond
  </code></pre>
  
  <p><strong>Update 3:</strong>
  I ran <code>ps -ef | grep cron</code> and I get:</p>
  
  <pre><code>root      1404     1  0 Oct31 ?        00:00:00 crond
  myappuser    3961  2746  0 10:56 pts/1    00:00:00 grep cron
  </code></pre>
  
  <p><strong>Update 4:</strong>
  I ran <code>/bin/bash -l -c 'cd /home/clippo/clippo2 &amp;&amp; bin/rails runner -e production '\''Video.send_to_wistia'\'''</code> and this is what I see:</p>
  
  <pre><code>/home/myuser/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/runner.rb:53:in `eval': No such file or directory - /home/myuser/myapp/tmp/video_uploads/190 (Errno::ENOENT)
      from /home/myuser/myapp/app/models/video.rb:31:in `new'
  </code></pre>
  
  <p>This error message is really confusing because that directory DOES exist and always has.</p>