PDA

View Full Version : Dynamically Generate Filename in Cron


allan
04-24-03, 12:27 AM
I need to run a task every four hours, and I want the output of the task to have the date in the filename. Is there a way to do this in cron?

The cron currently looks like this:


0 0,4,8,12,16,20 * * * cd /var/tmp; /bin/sh script.sh >> output.file


I would like the output.file to be replaced with output.timedate

Is this possible?

allan
04-24-03, 01:32 AM
Nevermind, I just wrote a shell script that did this and set the cron to point to the shell script :).