Are jobs scheduled with 'at' persistent across reboots? Also, anyone know of a way the jobs could be backed up without access to the relevant spool directories?

I want to send an email at specified intervals from now up to a year ( ie 1 week, 1 month, 6 months) so this seems like a good tool, maybe there is a better one?


Yes they are persistent across reboots (they're just files in a spool).

Regarding having access to them, as a regular user you won't have access to the files, but you could build a system to back them up. Maybe something like this:


/bin/rm -rf $MYAT/*

at -l >$MYAT/JOBS
for j in `cat $MYAT/JOBS | cut -f1`
  at -c $j >$MYAT/$i

If you needed to reload the job later:

for j in `cat $MYAT/JOBS | cut -f1`
  # make sure the job isn't defined
  atrm $j
  # reload it from the file
  at -f $MYAT/$j `grep ^$j $MYAT/JOBS | awk '{ print $3, $2 }'`

(this is all mostly untested. The basic command are right but there's sure to be a bug in the logic in there somewhere)

Having said all that though, I'm not sure I'd use at for the task you describe. I'd probably use a preexisting calendaring system. Failing that though, I would user a cron job that ran daily that checked a file to see if there were any messages to send. Much more portable than at jobs, and much more likely to be remembered if you switch machines...

  • I see how that backs up the jobs, but how would I reload all those jobs if needed? – Kyle Brandt May 27 '09 at 13:47

When you schedule a job with at, even if a reboot is done (they are stored in /var/spool/cron/atjobs), the job is still planned.



I've not used the at command much, but I have used cron to schedule tasks to be executed, and it is persistent across reboots. cron has worked for me for the past fifteen years or so.

If need a command to be executed once every day, and then be executed once even if the system goes down, you can use anacron.

  • I don't think cron is really good for this unless I use it as jj33 stated because I don't want to run something at regular intervals. For example, when I schedule even A I will want event A to run one month from now, but not every month. – Kyle Brandt May 27 '09 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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