I can easily get a copy of my pending cron jobs so I can keep a backup. "crontab -l > mycron.txt" is part of my backup script, and that does the job nicely.
Is there a way that I can get a copy of pending at jobs for this purpose? I can get a list of pending jobs with atq, and I can show each job with at -c jobname, but I don't see a way to get something that is suitable for use as a file that I can keep as a backup of the pending jobs.
On Sat, 1 Mar 2014 18:47:03 -0600 Frank Cox wrote:
I can easily get a copy of my pending cron jobs so I can keep a backup. "crontab -l > mycron.txt" is part of my backup script, and that does the job nicely.
Is there a way that I can get a copy of pending at jobs for this purpose?
This output is a bit long-winded, but it should do for my purposes. Maybe I'll pretty it up a bit more sometime:
#!/bin/bash atq for each in $(atq | cut -f 1); do echo "JOB $each"; at -c $each; done