At and Batch usage

At and Batch:
at and batch read commands from standard input or a specified file which are to be executed at a later time, using sh.batch executes commands when system load levels permit; in other words, when the load average drops below 1.5, or the value specified in the invocation of atd.

Linux At Command:
The Linux “at” command also can be used for scheduling jobs. But using Linux “at” command, you can set the job run only once. The “at” jobs are spooled in the “/var/spool/at” directory and run at the specified time.
The “at” daemon can be used to run a command or script of your choice. From the command line, you can run the “at” time command to start a job to be run at a specified time. That time can be now; in a specified number of minutes, hours, or days; or at the time of your choice.
To schedule a one-time job at a specific time, type the command at time, where time is the time to execute the command.
The Linux at command argument time can be one of the following:
• HH:MM format — For example, 04:00 specifies 4:00AM. If the time is already past, it is executed at the specified time the next day.
• midnight — Specifies 12:00AM.
• noon — Specifies 12:00PM.
• teatime — Specifies 4:00PM.
• month-name day year format — For example, January 15 2002 specifies the 15th day of January in the year 2002. The year is optional.
• MMDDYY, MM/DD/YY, or MM.DD.YY formats — For example, 011502 for the 15th day of January in the year 2002.
• now + time — time is in minutes, hours, days, or weeks. For example, now + 5 days specifies that the command should be executed at the same time in five days.

Linux at command examples

Command Example
at now + 10 minutes
Associated jobs will start in 10 minutes.
at now + 2 hours
Associated jobs will start in 2 hours.
at now + 1 day
Associated jobs will start in 1 day (24 hours).
at now + 1 week
Associated jobs will start in 7 days.
at teatime
Associated jobs will start at 4:00 P.M.
at 3:00 6/13/07
Associated jobs will start on June 13, 2007, at 3:00 A.M.

1. One-off job schedulers
2. 'at' runs based on time schedule
3. 'batch' runs based on system-utilization stats
1. Use 'at' to run jobs
a. 'at 15:58'
b. 'at -f at.job.1 16:02'
c. 'at now + 1 day' - runs job 1-day from now (time submitted to job-queue)

Linux Batch Command:
Use 'batch' to run jobs
a. 'batch' - supply instructions on STDIN
Note: 'batch' accepts no command line options
Note: 'at'runs the jobs on behalf of 'batch'
Note: 'batch' is simply a special invocation of 'at'

No comments:

Post a Comment