Execute job once at specific time

suggest change

Note: at is not installed by default on most of modern distributions.

To execute a job once at some other time than now, in this example 5pm, you can use

echo "somecommand &" | at 5pm

If you want to catch the output, you can do that in the usual way:

echo "somecommand > out.txt 2>err.txt &" | at 5pm

at understands many time formats, so you can also say

echo "somecommand &" | at now + 2 minutes
echo "somecommand &" | at 17:00
echo "somecommand &" | at 17:00 Jul 7
echo "somecommand &" | at 4pm 12.03.17

If no year or date is given, it assumes the next time the time you specified occurs. So if you give an hour that already passed today, it will assume tomorrow, and if you give a month that already passed this year, it will assume next year.

This also works together with nohup like you would expect.

echo "nohup somecommand > out.txt 2>err.txt &" | at 5pm

There are some more commands to control timed jobs:

All commands apply to jobs of the user logged in. If logged in as root, system wide jobs are handled of course.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents