cronjob not working but script works
hi all
i've got this strange problem i'm using red hat 9 php5 mysql 4.1.7 i wrote a script to reset some mysql tables and rename them from the command line then i put in an executable text file Code:
cd /usr/bin i can run it from the command line with ./resetmonth and the tables update properly but when i set the cron job as Code:
0 0 1 * * /path/to/resetmonth but it doesn't do anything (could it be changing the date like that?) i have another cron job that runs every day and uses the same code in the exe text file, and that works can anyone give me a clue as to what the problem might be thanks dave |
Check the permissions on your executable script file. You may have it executable as user but not executable as root.
--------------------------- Steve Stites |
You might want to change the "php" line to use an absolute path. E.g. /usr/bin/php, if that's where php lives on your system.
|
hey, thanks guys for your replies
but unfortunately they didn't solve the problem the script and exe have the same permissions as the other one which runs fine and the path is the same as well the problem is that the php script runs fine when run from the exe from the command line i guess the only difference is that one php script runs using a local database (doesn't work from cron) and the other one runs using a remote database (does work) any other ideas |
Perhaps it's something with the standard file descriptors (stdin, stdout, stderr)? That's just speculation, but it's one thing which is different from running it from a shell.
Try sticking a /usr/bin/strace -f /usr/bin/php ... in there instead. The drawback here is that there will be a lot of output, but cron should just email it to you. The output from strace should give you an idea as to what's failing. |
All times are GMT -5. The time now is 05:14 PM. |