Maybe I'm completely nuts, and if so – that's fine. But how would I schedule a job to on-some-random-schedule broadcast a goofy message, like from fortune
?
clarification
yes – this is my personal workstation – not planning to do something wonky on a production server 🙂
Best Answer
at
has a simpler interface for this type of purpose ifat
is installed, the machine is runningatd
and the user is allowed to use the command.For example (check the exact syntax using
man at
orinfo at
),at -f
filenow + 53 minutes
or
at -f
filenow + 2 hours
will run the commands in the specified file in 53 minutes or 2 hours, respectively.
at
can then be re-run at the start of the scheduled job with suitable (random or otherwise) start, count, and time-units.Edit
As Arjan points out helpfully below, if you are using this for other than a toy application you need to think about issues such as what happens
if the next run starts before the previous one finishes (e.g. is the script re-entrant?) or
if a run fails to complete correctly or
if the next run fails to start at all or on time (e.g. what happens if the machine is off when the next run is due to start) and
about the logging and reporting of failed or successful runs.