I wrote a Rake script that should run automatically with Crontab. The script works fine when typing on the command line, but does not work correctly inside cron.
The script looks like this:
#!/bin/sh
echo `date`
cd /home/mick/myapp/current
rake RAILS_ENV=production mynamespace:myaction
The crontab setup looks like this:
10 0,6,12,18 * * * /home/mick/work/launch.sh >> /home/mick/work/launch.log
After execution, the log file just contains a date, but nothing else, and the error I get in syslog looks like this:
Mar 18 18:10:01 CRON[21773]: (mick) CMD (/home/mick/work/launch.sh >> /home/mick/work/launch.log)
Mar 18 18:10:01 CRON[21772]: (CRON) error (grandchild
Mar 18 18:10:01 postfix/sendmail[21776]: fatal: open /etc/postfix/main.cf: No such file or directory
Mar 18 18:10:01 CRON[21772]: (mick) MAIL (mailed 1 byte of output; but got status 0x004b,
EDIT :
Thanks @Holger Just a comment, I found this link that helped me get a working script.
Here is the updated version of my script
export PATH=blabla
source /home/mick/.rvm/environments/default
echo `date`
cd /home/mick/myapp/current
rake RAILS_ENV=production mynamespace:myaction
source
share