Schedule a command to run later in Ubuntu or any other Linux machines | UbuntuCafe

Schedule a command to run later in Ubuntu or any other Linux machines

You can use the at command. The at execute commands at a later time. The at utility shall read commands from standard input and group them together as an at-job, to be executed at a later time.
The  at  utility shall read commands from standard input and group them together as an at-job, to be executed at a later time.

The at-job shall be executed in a separate  invocation  of  the  shell,running  in  a  separate  process  group  with no controlling terminal,except that the environment  variables, current working directory,  file creation   mask,   and   other   implementation-defined  execution-time attributes in effect when the at utility is executed shall be  retained and used when the at-job is executed.

Example:

If you want to run a script after 8 hours from now, issue the following command:

at now +8 hours -f ~/myscript.sh

You can also use convenient shorthands, like tomorrow or noon, as in

echo "tweet fore" | at teatime

The example also demonstrates how you can pipe actions into at. at -c is the way you can examine scheduled actions, which you can conveniently list with their number, as with:

at -c 3

Post a Comment