• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

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

How VPS by How VPS
November 2, 2018
in Linux, Operating System
0
0
SHARES
45
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Summary

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:

# echo "ping -c 4 www.google.com" | at -m now + 1 minute

If you choose to not use the -m option, the command will be executed but nothing will be printed to standard output. You can, however, choose to redirect the output to a file instead.

In addition, please note that at not only allows the following fixed times: now, noon (12:00), and midnight (00:00), but also custom 2-digit (representing hours) and 4-digit times (hours and minutes).

For example,

To run updatedb at 11 pm today (or tomorrow if the current date is greater than 11 pm), do:

# echo "updatedb" | at -m 23

To shutdown the system at 23:55 today (same criteria as in the previous example applies):

# echo "shutdown -h now" | at -m 23:55

You can also delay the execution by minutes, hours, days, weeks, months, or years using the + sign and the desired time specification as in the first example.

Time specifications are subject to the POSIX standard.

Summary

As a rule of thumb, use at instead of cron job scheduler whenever you want to run a command or execute a given task at a well-defined time only once. For other scenarios, use cron.

Next, we shall cover how to encrypt tar archive files using openssl, till then stay connected to Tecmint.

Source: tecmint.com

Tags: Linux Commandslinux guidelinux vps setup guide
Previous Post

How to Record and Replay Linux Terminal Sessions using ‘script’ and ‘scriptreplay’ Commands

Next Post

4 Ways to Disable/Lock Certain Package Updates Using Yum Command

Next Post

4 Ways to Disable/Lock Certain Package Updates Using Yum Command

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet