Good Afternoon! I am kind of new at this but I am trying to set up a cron job. Below is the cron job that I have set up using crontab -e on an AIX server.
23 10 * * 1-5 CjisReturn >> /LGS/DEVELOPMENT/CLERK.DATA/AL.CJIS.CRON.LOG/CronReturnLog.txt 2>&1
The above output will be appened to the file named CronReturnLog.txt and this seems to work fine.
My question is, can I make this key for my file dynamic?
Currently the log is keyed CronReturnLog.txt but I would like to use the current date for the key, is there a way to do this in crontab -e?
Any information would be greatly appreciated, thanks for your tiume...
This topic has been locked.
2 replies Latest Post - 2013-02-07T18:09:49Z by SystemAdmin
Pinned topic crontab - output file
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2013-02-07T18:09:49Z at 2013-02-07T18:09:49Z by SystemAdmin
The_Doctor 2700018ASD91 PostsACCEPTED ANSWER
Re: crontab - output file2013-02-06T21:30:11Z in response to SystemAdminThere are many ways to do this. Google is probably your best friend when it comes to this stuff. Anyway here's a couple of examples:
23 10 * * 1-5 CjisReturn >> /LGS/DEVELOPMENT/CLERK.DATA/AL.CJIS.CRON.LOG/Cron.$(date \+\%y\%m\%d).ReturnLog.txt 2>&1 # be sure to escape \ the special characters otherwise you can expect undesireable results when run under cron
23 10 * * 1-5 /home/root/bin/skelton.script
then the skelton.script contains
#!/bin/ksh WHATEVER=$(date +%y%m%d) # do pretty much whatever you want here /full path name may be needed/CjisReturn >> /LGS/DEVELOPMENT/CLERK.DATA/AL.CJIS.CRON.LOG/Cron.$WHATEVER.ReturnLog.txt 2>&1