I have a script that works when called:
/usr/local/bin/myscript #this works fine
Permissions for the file are:
-rwxr-xr-x 1 root root 155 Jan 27 09:34 myscript
I've added a line to /etc/crontab:
* * * * * root /usr/local/bin/myscript
But cron doesn't seem able to run this.
The crontab has the PATH variable set:
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
The script is a mysqldump to the /var/tmp/ directory:
#!/bin/bash
DAY=`date +%y%m%d`
TIME=`date +%k%M`
mysqldump test -u john -pxxxxxxx > /var/tmp/$DAY.$TIME.test.sql
I can't think what is wrong with this, but the script isn't running.
Edit: /var/log/syslog shows the following entries:
Jan 27 10:20:01 hector CRON[8286]: (root) CMD (/bin/bash /usr/local/bin/myscript)
Jan 27 10:20:01 hector CRON[8285]: (CRON) info (No MTA installed, discarding output)
So I guess it's trying to run the script, but it must be failing somewhere because I don't get the same output as if I ran it with /usr/local/bin/myscript
.