Is there a utility like cron, that schedules a job for later (but only once)?
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:
Script A runs and detects the next time of the event
Script A uses ??? to schedule Script B be to run at $time
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?
Solution 1:
Yup. It is called at.
Example:
echo 'logrotate -f /etc/logrotate.conf' | at '00:00'
Solution 2:
If you've got a script in a file already, at -f scriptname '00:00'
is pretty useful also.