AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
 View Only
  • 1.  crontab - output file

    Posted Wed February 06, 2013 12:46 PM

    Originally posted by: SystemAdmin


    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...

    Thomas
    #AIX-Forum


  • 2.  Re: crontab - output file

    Posted Wed February 06, 2013 04:30 PM

    Originally posted by: The_Doctor


    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
    

    OR
    
    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
    

    #AIX-Forum


  • 3.  Re: crontab - output file

    Posted Thu February 07, 2013 01:10 PM

    Originally posted by: SystemAdmin


    Hey, this is great information. Exactly what I was looking for. Thank you so much for your help...
    #AIX-Forum