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...
The_Doctor 2700018ASD98 Posts
Re: crontab - output file2013-02-06T21:30:11ZThis is the accepted answer. This is the accepted answer.There 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
SystemAdmin 110000D4XK6902 Posts