How to schedule an at job in linux?



  • An at job is a job that needs to be run at a specific time only.

    At the prompt, type at followed by the time you want the job to run. Then at the at> prompt, type the command you want to run, then enter, then another command if necessary, then enter then Ctrl-D.

    # /usr/bin/at 09:10
    at> df -h > /tmp/at.out
    at> 
    job 2 at 2009-07-21 09:10
    

    The above command will run a "df -h" at 09:10 and the output will be redirected to /tmp/at.out.

    The format for "time" can be any of the following:
    hh:mm i.e. 01:00 is 1am. If the specified time has already gone, the command is executed at that time the following day.
    midnight
    noon
    teatime 4pm

    You can also specify a date after the time (although the time must be listed first) in the possible formats below:

    month day year i.e. July 21 2009. If you don't list the year, it selects this year.
    MMDDYY or MM/DD/YY or MM.DD.YY .e. 210709 or 21/07/09 or 21.07.09.
    now + time (time is in minutes, hours, days, or weeks) i.e. now + 2 hours or now + 2 weeks (will run the command at the time it is now but in two weeks' time).


Log in to reply
 

© Lightnetics 2024