Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

87%
+12 −0
Q&A Run a command *later*

The traditional way on a *nix system to run a one-time command at some specified future time is at. $ at 'now + 10 minutes' at Wed Aug 23 19:00:00 2023 at> date >> ~/current-time at&gt...

posted 9mo ago by Canina‭  ·  edited 9mo ago by Canina‭

Answer
#2: Post edited by user avatar Canina‭ · 2023-08-23T19:09:37Z (9 months ago)
  • **The traditional way on a \*nix system to run a command at some future time is `at`.**
  • $ at 'now + 10 minutes'
  • at Wed Aug 23 19:00:00 2023
  • at> date >> ~/current-time
  • at> ^D
  • job NNN at Wed Aug 23 19:00:00 2023
  • $
  • You can also specify a particular time, which will be interpreted as "next time the real time is X":
  • $ at '16:00'
  • at Wed Aug 24 16:00:00 2023
  • ...
  • or a date and time, although the syntax is a little peculiar:
  • $ at '22:00 Aug 29'
  • at Tue Aug 29 22:00:00 2023
  • ...
  • $ at '22:00 Jul 29'
  • at Mon Jul 29 22:00:00 2024
  • ...
  • $ at '22:00 Jul 29 2025'
  • at Tue Jul 29 22:00:00 2025
  • ...
  • Normally, after the job finishes executing, any output (stdout or stderr) will be delivered in an email to the account which scheduled the job.
  • I do believe that most `at` implementations will start executing the job *as soon as the specified time has occurred*. So if the system is powered off, or `atd` otherwise isn't running, at the specified time, the job will execute the next time `atd` is started.
  • At least on a typical Debian system, it's also possible to pipe a command into `at` to schedule it; for example:
  • $ echo date | at 'now + 10 minutes'
  • will run `date` after approximately ten minutes.
  • To see which jobs are queued for execution, use `atq`. To see what a job will do when it is executed, use `at -c $JOBID`. To delete a job, use `atrm $JOBID`.
  • **The traditional way on a \*nix system to run a one-time command at some specified future time is `at`.**
  • $ at 'now + 10 minutes'
  • at Wed Aug 23 19:00:00 2023
  • at> date >> ~/current-time
  • at> ^D
  • job NNN at Wed Aug 23 19:00:00 2023
  • $
  • You can also specify a particular time, which will be interpreted as "next time the real time is X":
  • $ at '16:00'
  • at Wed Aug 24 16:00:00 2023
  • ...
  • or a date and time, although the syntax is a little peculiar:
  • $ at '22:00 Aug 29'
  • at Tue Aug 29 22:00:00 2023
  • ...
  • $ at '22:00 Jul 29'
  • at Mon Jul 29 22:00:00 2024
  • ...
  • $ at '22:00 Jul 29 2025'
  • at Tue Jul 29 22:00:00 2025
  • ...
  • Normally, after the job finishes executing, any output (stdout or stderr) will be delivered in an email to the account which scheduled the job.
  • I do believe that most `at` implementations will start executing the job *as soon as the specified time has occurred*. So if the system is powered off, or `atd` otherwise isn't running, at the specified time, the job will execute the next time `atd` is started.
  • At least on a typical Debian system, it's also possible to pipe a command into `at` to schedule it; for example:
  • $ echo date | at 'now + 10 minutes'
  • will run `date` after approximately ten minutes.
  • To see which jobs are queued for execution, use `atq`. To see what a job will do when it is executed, use `at -c $JOBID`. To delete a job, use `atrm $JOBID`.
#1: Initial revision by user avatar Canina‭ · 2023-08-23T19:09:03Z (9 months ago)
**The traditional way on a \*nix system to run a command at some future time is `at`.**

    $ at 'now + 10 minutes'
    at Wed Aug 23 19:00:00 2023
    at> date >> ~/current-time
    at> ^D
    job NNN at Wed Aug 23 19:00:00 2023
    $

You can also specify a particular time, which will be interpreted as "next time the real time is X":

    $ at '16:00'
    at Wed Aug 24 16:00:00 2023
    ...

or a date and time, although the syntax is a little peculiar:

    $ at '22:00 Aug 29'
    at Tue Aug 29 22:00:00 2023
    ...
    $ at '22:00 Jul 29'
    at Mon Jul 29 22:00:00 2024
    ...
    $ at '22:00 Jul 29 2025'
    at Tue Jul 29 22:00:00 2025
    ...

Normally, after the job finishes executing, any output (stdout or stderr) will be delivered in an email to the account which scheduled the job.

I do believe that most `at` implementations will start executing the job *as soon as the specified time has occurred*. So if the system is powered off, or `atd` otherwise isn't running, at the specified time, the job will execute the next time `atd` is started.

At least on a typical Debian system, it's also possible to pipe a command into `at` to schedule it; for example:

    $ echo date | at 'now + 10 minutes'

will run `date` after approximately ten minutes.

To see which jobs are queued for execution, use `atq`. To see what a job will do when it is executed, use `at -c $JOBID`. To delete a job, use `atrm $JOBID`.