Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to design a program that sends a text when a certain (non-periodic) event occurs. Right now, I'd like a script that finds when this event occurs, and then schedules a (cron-like) job that will send a text just before that even occurs.

A more concrete example would look like this:

  1. Script A runs and detects the next time of the event

  2. Script A uses ??? to schedule Script B be to run at $time

  3. At $time, ??? calls script B which sends the text.

The problem is, the event could be at a random time within 11 days, and it only happens once. Cron seems inappropriate for this -- I don't want this job to run more than once.

So I guess (in short), is there a utility that provides for the delayed execution of a script that's not periodic?

share|improve this question
up vote 37 down vote accepted

Yup. It is called at.

Example:

echo 'logrotate -f /etc/logrotate.conf' | at '00:00'
share|improve this answer
    
This is exactly what I was looking for, thanks! – user1209326 Apr 13 '13 at 18:23

If you've got a script in a file already, at -f scriptname '00:00' is pretty useful also.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.