command: at

Rob

Administrator
Staff member
There is a little known command in linux that is very handy when scheduling a task. Normally server administrators prefer using CRON for handling all scheduling. However, CRON is primarily designed for setting up recurring schedules and isn't really the right tool for one time jobs. If you have a server task that needs to be run at a particular time just once, then I suggest using `at`.

The syntax of at is straightforward.

COMMAND - DATE

Here is an example: (run this file at 10am, on December 24th)
Code:
at -f /usr/local/bin/reboot.pl 14:45
where reboot.pl contains
Code:
#!/usr/bin/perl
`shutdown -r now`;
Fancy things you can do with `at`.

You can get an email when the task is run by using
-m

You can change the shell that executes the job
-c -k -s (C, Korn, Bourne)

You can specify a file that contains the command to run
-f
Code:
at -f /usr/local/bin/reboot.pl 14:45
You can list the commands that `at` has in its queue
-l
Code:
at -l
You can cancel a pending `at` job
-r
Code:
at -r 9
 



Members online


Latest posts

Top