Sending cron output to a file with a timestamp in its name
Posted
by
Philip Morton
on Server Fault
See other posts from Server Fault
or by Philip Morton
Published on 2010-02-27T00:33:21Z
Indexed on
2013/10/23
3:58 UTC
Read the original article
Hit count: 504
I have a crontab like this on a LAMP setup:
0 0 * * * /some/path/to/a/file.php > $HOME/cron.log 2>&1
This writes the output of the file to cron.log. However, when it runs again, it overwrites whatever was previously in the file.
How can I get cron to output to a file with a timestamp in its filename?
An example filename would be something like this: 2010-02-26-000000-cron.log
I don't really care about the format, as long as it has a timestamp of some kind.
Thanks in advance.
© Server Fault or respective owner