Linux at command persistent across reboots?
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?
Solution 1:
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:
MYAT=~/atjobs
/bin/rm -rf $MYAT/*
at -l >$MYAT/JOBS
for j in `cat $MYAT/JOBS | cut -f1`
do
at -c $j >$MYAT/$i
done
If you needed to reload the job later:
for j in `cat $MYAT/JOBS | cut -f1`
do
# 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 }'`
done
(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...
Solution 2:
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.
Cordialy,