Using atd Command In Linux (Examples)

atd command in Linux platform is basically the ‘at’ daemon which runs in background and executes command at a specific time. It’s like cron, however the only difference is, atd runs the command only for once. With the usage of atd, one can schedule both one-off commands and scripts easily at a specified time.

How to install atd in Linux distros

In order to work with atd, it’s required to install it on machine and its installation commands are different in various Linux distributions. So, read through the commands used to install atd in various Linux platforms.

For Debian/Ubuntu/Mint

sudo apt install at

For Fedora

sudo dnf install at

For CentOS/RHEL

sudo yum install at

For OpenSUSE

sudo zypper install at

For Arch/Manjero

sudo pacman -S at

Syntax to use atd command in Linux

atd [-l load_avg] [-b batch_interval] [-d] [-f] [-s]

Available options to use with atd command

-l: Used for specifying a limiting load factor, means, the batch jobs should not be run over that.
-b: Used for specifying the minimum interval in seconds between the start of two batch jobs.
-d: Used for debugging and printing error messages to standard error. Also, this option implies -f option.
-f : Used for running atd command in foreground.
-s: Used for processing the at/batch queue for once. Mostly, this option is used for compatibility with old versions of at, atd-s that is equivalent to older atrun command.

Also Read:   Using ccrypt Command- Encrypt/Decrypt Files In Linux

How to start and enable atd

If you are going to work with atd, you first need to start and enable it. To do so, run the command below:

sudo systemctl start atd
sudo systemctl enable atd

To start the atd automatically while the system boots, you can run the following command:

chkconfig atd on

Note: In case you receive error “Can’t open /var/run/atd.pid to signal atd. No atd running” while using atd command, it means you have not started it, and the above mentioned commands will help you.

How to stop/disable/restart/checking status of atd in Linux

To stop atd

service atd stop

To disable atd from starting at boot time

chkconfig atd off

To restart atd

service atd restart

To check status of atd

service atd status

Nishant

Nishant Verma is a senior web developer who love to share his knowledge about Linux, SysAdmin, and more other web handlers. Currently, he loves to write as content contributor for ServoNode.