linux poison RSS
linux poison Email

Using “at” command to schedule jobs in Linux

At allows fairly complex time specifications, extending the POSIX.2 standard. It accepts times of the form HH:MM to run a job at a specific time of day. (If that time is already past, the next day is assumed.)

You may also specify midnight, noon, or teatime (4pm) and you can have a time-of-day suffixed with AM or PM for running in the morning or the evening. You can also say what day the job will be run, by giving a date in the form month-name day with an optional year, or giving a date of the form MMDDYY or MM/DD/YY or DD.MM.YY.

The specification of a date must follow the specification of the time of day. You can also give times like now + count time-units, where the time-units can be minutes, hours, days, or weeks and you can tell at to run the job today by suffixing the time with today and to run the job tomorrow by suffixing the time with tomorrow.

The superuser may use these commands in any case. For other users, permission to use at is determined by the files /etc/at.allow and /etc/at.deny.

If the file /etc/at.allow exists, only usernames mentioned in it are allowed to use at.

If /etc/at.allow does not exist, /etc/at.deny is checked, every username not mentioned in it is then allowed to use at.

If neither exists, only the superuser is allowed use of at.

An empty /etc/at.deny means that every user is allowed use these commands, this is the default configuration.

Examples of using at command:
:~ # at 12:00
warning: commands will be executed using /bin/sh
at> echo "At example" > /home/nikesh/at.example
at>
job 2 at 2010-04-05 12:00
:~ #
Use atq to know the current jobs in queue. Jobs that are running have a status as” =” and jobs to be scheduled have a status “a” .The displayed output is the format 

# atq
1       2010-04-05 12:00 a root
2       2010-04-05 12:00 a root


3 comments:

Post a Comment

Related Posts with Thumbnails