command: at

Rob

Administrator
Staff member
Credits
74
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
 


TechnoJunky

Well-Known Member
Credits
304
Have you guys looked in the repository for it? It's in the Ubuntu repo.

AT is a command that comes installed on Windows by default. Didn't know there was a Linux version too.
 

calkines

New Member
Credits
12
Using Ubuntu over WSL1 on Windows causes this message: "Can't open /var/run/atd.pid to signal atd. No atd running?".

I'll try to execute with WSL2
 


Members online


Top