1

In my schedule:

every 10.minutes do
  runner "Model.method"
end

Whenever created this in my crontabs

0,10,20,30,40,50 * * * * /bin/bash -l -c 'cd /home/projects/Monitoring && script/rails runner -e development '\''Model.method'\'''

I tried to run the command in my console and it works. Why does it not work automaticly, i am going insane!

In my syslog

Mar 11 11:38:01 UbuntuRails CRON[20050]: (ruben) CMD (/bin/bash -l -c 'cd /home/projects/Monitoring && script/rails runner -e development '\''Ping.check_pings'\''')
Mar 11 11:38:01 UbuntuRails CRON[20048]: (CRON) info (No MTA installed, discarding output)
Mar 11 11:38:01 UbuntuRails CRON[20047]: (CRON) error (grandchild #20050 failed with exit status 1)
Mar 11 11:38:01 UbuntuRails CRON[20047]: (CRON) info (No MTA installed, discarding output)
Nostrodamus
  • 619
  • 1
  • 6
  • 8
  • Do you have cron running locally? You can also add `set :output, File.join(path, 'log', 'cron.log')` in your schedule.rb to log the output. – jemminger Mar 11 '11 at 20:08

1 Answers1

3

I am on Ubuntu 10.10 and had the same problem.
Turns out the -l option does not load the environment as expected, but -i does. (see this issue)

As the issue thread states, the fix is to edit your schedule.rb and add:

set :job_template, "/bin/bash -i -c ':job'"

Cheers

Arnis Lapsa
  • 45,880
  • 29
  • 115
  • 195
Dr Zen
  • 31
  • 1
  • 2