I have a seriously weird problem with one of the Ubuntu 10.10 web servers i administer.
I wrote a script using ruby and rake to run some tar commands and do a mysqldump of the databases,
I've installed an entry in the root users crontab like so:
0 0,12 * * * /bin/bash -l -c 'cd /my/script/path && rake backup:everything'
This is working perfectly on one of the servers..
However on the other this doesn't actually seem to execute whats in my script..
I know it's getting called for deffinate because when i run
grep CRON /var/log/syslog
Mar 22 12:00:01 ServerName CRON: (root) CMD (/bin/bash -l -c 'cd /my/script/path && rake backup:everything')
However it's deffinately not doing whats in that script..
When i directly run the script like this:
cd /my/script/path && sudo rake backup:everything
It works perfectly..
Also just for interest i did this in the crontab of both servers:
0 0,12 * * * /bin/bash -l -c 'cd /my/script/path && rake backup:everything >> output.txt'
(as in the script i'm doing a "puts 'backing up x folder'" every so often)
On the server where the cron job is working it creates the output.txt file and puts the expected output in there like "Beginning backup" etc..
However on the server where it isnt working it only creates the file but leaves it empty..
But when i copy the command run from the syslog again and run it manually:
sudo /bin/bash -l -c 'cd /my/script/path && rake backup:everything >> output.txt'
It works fine and the output is as expected..
I may be clutching at straws now but could it be anything to do with this:
CRON: (root) MAIL (mailed 55 bytes of output but got status 0x004b#012)
This appears in the syslog after EVERY cron call.. i only really have this cron job and another small one to update the system clock.. but from the looks of it none of them are working correctly..
Is an incorrect mail configuration killing my cron jobs..?
Is that even possible?