Scheduling
of tasks under Linux is an extremely powerful procedure which
is used by almost everyone. Scheduling of tasks basically means
running whichever program you want at a particular time without
having to manually be present at the machine at that time. Linux
will run that program for you at that time. In this article
I shall explain the simplest way to schedule tasks using the
simple command called 'at'.
Advanced task scheduling is possible using 'cron' which
is explained in Article No. 16 on this
website. Please use 'cron' if you want to repeatedly
execute any task.
Procedure :
At the prompt type this command followed by <Enter>
$ at 2359
The moment you press Enter the prompt changes into an arrow
indicating that more information is required by Linux. Type
the following command assuming you have installed XMMS player
which plays mp3 files and that you actually have a mp3 file
in the directory shown below
> xmms /home/david/mp3s/rock_my_world.mp3
Once you have typed the above press <Enter> and then finally
press <Ctrl>-D
Thats it. Now Linux will make the XMMS player to play the particular
mp3 file at the time 23:59. Thats just a minute before midnight.
Linux surely rocks your world !! ;-)
Basically if you are using the 24 hour clock then you enter
the time you want with the hours and the minutes together one
after another. Hours = 0-23 & Minutes = 0-59. Then type
the exact command that you would have typed had you wanted to
execute the task manually. If you want you can issue more commands
after the first one. Once you finish entering all the tasks
press <Ctrl>-D to indicate that you have finished. Then
wait and enjoy.. Linux will do the rest.
Remember :
At any time you can see the list of pending jobs by typing the
following at the prompt
$ at -l (that a lowercase 'L')
If you want to remove any particular job in case you suddenly
decided that you don't want that program to execute then first
get the list of pending jobs as shown above. You will see that
every job has a corresponding ID associated with it. Use the
command below (In this case to remove job with ID=10)
$ atrm 10