How can I redirect and append stdout and stderr to a file when using cron? Here is my crontab file:
*/5 * * * * /dir/php /dir/process_fns.php >>& /dir/dump.txt
Cron gives me an 'unexpected character found in line' when trying to add my crontab file.
Regards,
Zach Curtis
POPULUS
Ok, thanks.
The error from my crontab was a result of '*/5'. Here my new crontab file that does now work, with both stderr and stdout being sent to a file.
5 * * * * /dir/php /dir/process_fns.php >> /dir/dump.txt 2>&1
Zach
RTM
August 29, 2002, 2:14pm
4
Remove the /5 and replace with 5 or 05 to get rid of the unexpected character error.
(I see you have figured it out!)
Some versions of cron (I think Vixie cron - not sure though)will allow you to use the "*/5 * * * *" notation to mean "every five minutes".
Check your version of cron to see if it supports this.
I though it would have been the stray "&" near the end of the line...
well i would say that the empty "&" was the problem.
changing */5 to 5 would change the program to run at 5 mins past every hour rather than running every 5 minutes.
dunno if that is different in different versions of cron.
what do you say peter
Maybe that's me..... although I doubt that as I'm not involved in this post. But I'll take it as a vote of confidence!
asifraj
September 2, 2002, 6:13am
9
sorry. i meant livinFree.
i guess i was sleeping when i posted that.