Logiciel Libre

October 16, 2006

Batching with at

Filed under: Default — Tags: — adam @ 10:26 pm CDT

Batch processing is a term that mainframe programmers used to use to refer to scheduled jobs. Batch processing is a form of automation, since the scheduled jobs must be able to execute without human interaction. Automation is fun, and is quite useful even in today’s post-mainframe world. While setting up automated tasks is time-consuming, the goal is to save time in the long run since you can reuse the commands you told the computer to perform.

at(1) is a program useful for scheduling a single job for execution. It is incredibly simple and can be quite useful in a pinch.

Say I wanted to run a one-time build of some software overnight.

$ at 10pm today
at> cd ~/my_source && ./make
at> <CTRL-D>
job 22 at 2006-10-14 17:00

Voila! The output will be collected by at and emailed to me.

What I actually typed in was:

at 10pm today<ENTER>
cd ~/my_source && ./make<ENTER>
<CTRL-D>

If I screw up typing in the job command(s), I use atrm <JOB_ID> to remove it. atq lists jobs ids and scheduled date/time and at -c <JOB_ID> prints out the actual shell script that makes up a job.

batch(1) lets me run a job whenever system load permits. On my Fedora Core 5 desktop, the computer is usually just sitting idle so I never schedule jobs with batch(1).

According to the man page, Thomas Koenig wrote most of at. Thanks, Thomas!

No Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment

Powered by WordPress