Pages

Thursday, June 1, 2017

How to Use ‘at’ Command to Schedule a Task on Given or Later Time in Linux

As an alternative to cron job scheduler, the at command allows you to schedule a command to run once at a given time without editing a configuration file.
The only requirement consists of installing this utility and starting and enabling its execution:
# yum install at              [on CentOS based systems]
$ sudo apt-get install at     [on Debian and derivatives]
Next, start and enable the at service at the boot time.
--------- On SystemD ---------
# systemctl start atd
# systemctl enable atd
--------- On SysVinit ---------
# service atd start
# chkconfig --level 35 atd on
Once atd is running, you can schedule any command or task as follows. We want to send 4 ping probes to www.google.com when the next minute starts (i.e. if it’s 22:20:13, the command will be executed at 22:21:00) and report the result through an email (-m, requires Postfix or equivalent) to the user invoking the command:

      ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
                                                    ► Read more: http://adf.ly/1n5XUy
      ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

No comments:

Post a Comment