Using at to Schedule Tasks


What if you quickly want to schedule a one-time-only task? For this, you can use the at command. This relies on a daemon that isn't activated by default on SUSE Linux, so you'll need to add it first.

Adding at to the Current Run Level

You can use YaST2 to add at to the current run level. Start YaST2, click System, and then click Runlevel Editor. The at daemon is called atd. Select it and click Enable.

This will start it at run levels 2, 3, and 5 every time the system is booted, until it's disabled. (Don't worry if YaST2 reports an additional service must be started to support atd.)

Adding a Job with at

Adding a job with at is very easy, largely because the at command accepts a wide variety of time formats. For example, the following will run a job at lunchtime tomorrow:

at noon tomorrow

It really is as simple as that!

Alternatively, you can specify a time, date, and even a year:

at 13:00 jun 25 2008

This will run the job at 1 PM on June 25, 2008. The various time and date formats are explained in the at command's man page.

Once the at command containing the date has been entered, you'll be presented with a mock shell prompt. Here, you can type the commands you want to run. Many shell commands can be entered, one after the other; just press Enter between them. Then press Ctrl+D to signal that you're finished editing. At this point, at will confirm the time and write the task into its list.

You can view the list at any time by typing atq. This will show a list of numbered jobs. You can remove any job by typing atrm, followed by its atq job number. For example, the following will remove the job numbered 9 in the atq list:

atrm 9




Beginning SUSE Linux from Novice to Professional
Beginning SUSE Linux: From Novice to Professional
ISBN: 1590594584
EAN: 2147483647
Year: 2005
Pages: 293
Authors: Keir Thomas

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net