command: at

Rob

Administrator
Staff member
Joined
Oct 27, 2011
Messages
1,203
Reaction score
2,230
Credits
3,442
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
 


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.
 
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
 
at : refusing to create job destined in the past.
plz tell me how to solved this.
 
type crontab -e

delete the duplicate crontab, that you trying to use at for.
 
type crontab -e

delete the duplicate crontab, that you trying to use at for.
do we have to write the code in here in the crontab file, or just input it to the terminal ?
and can you please show the usage and an example for this command
 
:confused:In CentOS 7, "at" command seems is not a default-installed component.
CentOS is very vanilla, you have to install every single tool manually :\

Edit: ok, it doesn't work for me either (I am an Ubuntu user) maybe you type sudo yum install at if you are on CentOS, for Debian users, write: sudo apt install at
 
Last edited:
Please open a fresh topic.

This topic is dated 2011
 
Last edited by a moderator:
That's OK Brian, I'll run with this one, as the Member is on topic, and if the OP @Rob has more to add or otherwise, he has seniority.

It is not working in debian as well, I even tried 'sudo apt install at'

@rajatkm93 , I have just tried it in 5 of my Debian and Debian-based distros and that works.

Try it again with this adjustment

Code:
sudo apt update && sudo apt install at

Any errors, please copy and paste them in code tags found under the first 3 vertical dots in your toolbar in the reply pane.

Cheers

Chris Turner
wizardfromoz
 
i tried to set echo "some command" | at time
it get on at list, but it doesn't execute on time, why?
when see list of command using at -l or atq i can see schedule time and command but it didn't run
 
I suggest starting a Thread with a meaningful title (including your Linux distro name) in Command Line.

Cheers

Wizard

and welcome to linux.org
 


Latest posts

Top