Linux 101 : Running a job once - The "at" command -



To be able to run a task at a set time, we could use the "at" command.

The "at" command does not run repetitive tasks, it runs a program only once.

We could specify the time when a program should run.

The "at" works in an interactive mode from which we could exit by pressing the "Ctrl - D" key combination.

Below is the syntax of the "at" command that opens an interactive mode in which we can type the command we want to execute at a set time:


Below are some of the options we could use with the "at" command:
  • -f file : reads the tasks from a file.
  • -t time : runs the task at the specified time.
Examples:

  • at noon : for 12 P.M.
  • at midnight : for 12 A.M.
  • at now + 5 minutes 
  • at now + 1 hour
  • at 6:00 PM July 20
If we want to include the command and the time in on the same line without going into the interactive mode, we could use for example:


To list all the pending jobs, we use the below command:

Comments

Leave as a comment:

Archive