Sunday, March 04, 2007

Schedule a Job At a Specified Time

We were required to dump of our production database prior to an upgrade. Since it was only going to be a one time affair, we didn't want to bother setting up a cronjob. So we decided to use the AT command to schedule the task. We used the "-m" option to send us mail to confirm its completion.

Note: Your login must be in the /etc/cron.d/at.allow file.

#cd /opt/db/scripts
#at -m 4am < dumpDB.sh
job 48736701.a at Sat Mar 3 12:34:00 2007

Displays a list of jobs in the queue
#at -l
user = esofthub 48736700.a Sat Mar 3 12:34:00 2007
user = esofthub 48736701.a Sat Mar 3 12:34:00 2007

Removes job from the queue
#at -r 48736700.a

MISC:
#at 6am
lp -d not_default_printer customer_taskfile
control ^d
job 48736702.a at Sat Mar 3 12:36:00 2007

#at 6am Mon
lp -d not_default_printer customer_taskfile
control ^d
job 48736703.a at Sat Mar 3 12:37:00 2007

#at -m 0700 Tue +2 weeks < print_accesslog_stats.sh
job 48736704.a at Sat Mar 3 12:38:00 2007


No comments: