I'm trying to get a ruby script to run via cron. The cron job looks like this:
* * * * * /usr/local/rvm/rubies/ruby-2.0.0-p353/bin/ruby /usr/share/adafruit/webide/repositories/shed_watcher/lib/shed_watcher.rb >> /tmp/cron_shed_watcher.log 2>&1 I've encountered a couple of problems. The first was that the environment cron runs in could find one of the required gems:
require "rest_client" This was solved by setting the GEM_PATH in the crontab:
GEM_PATH=/usr/local/rvm/gems/ruby-2.0.0-p353:/usr/local/rvm/gems/ruby-2.0.0-p353@global The second problem is that the script, running on Occidentals on a Raspberry Pi, makes use of a temperature probe and needs to call:
`modprobe w1-gpio` `modprobe w1-therm` i.e. modprobe commands in backticks. Cron cannot execute this, instead I get an "operation not permitted" message. modprobe is found in /sbin so I added a path entry to my crontab:
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin/usr/local/rvm/gems/ruby-2.0.0-p353/bin:/usr/local/rvm/gems/ruby-2.0.0-p353@global/bin:.... But I get the same error (not surprising as it was a "not permitted" message, not a "not found" message). What do I need to do to get this working?