at jobs

Use at:

Syntax:

at <date> - This will run the command at the specified time/date 

Example:

at 12:30am Aug 20 

After this command you will be prompted to enter the commands that you want to run:

How to schedule a job:

  1. Check the date with the date command in Linux to get the time

  2. Schedule the job

2.1 Schedule Job from File/Script:

Syntax:

at –vf <path/to/script/and/script/name.sh> <time>  

Flags:

-f = takes file to execute (script) 
-v = displays date when the job will be executed 

Example:

at -vf path/to/script now 

2.2 Schedule Job from Command:

Syntax:

at <time>  

This will open a prompt for input

• Enter command / commands you want to run • Once finished press CTRL + D

Check if the job is scheduled:

Command:

atq 

This will display the job schedule number first, the date when it will execute second and the user under which this executes third.

Removing incorrect job:

If the job is not scheduled correctly, you can remove this with: Command:

atrm <jobnumber> 

Example: The job scheduled below is the job with number 36 To remove the job the command used was: atrm 36 After executing this command, you can check if it was removed with atq

Extra Info:

To schedule a job 1h from now you can use the following command:

at –vf </path/to/script.sh> now + 1 hour 

Check the content of a Job:

at –c <job_number>

Last updated