Hardware Reference
In-Depth Information
Scheduled start
When we simply want to postpone the start of something for a few minutes, hours,
or days, the at command is a good fit.
Add it to the system using the following command:
pi@raspberrypi ~ $ sudo apt-get install at --no-install-recommends
The at command can optionally send e-mails with status reports, but since that
would require a small local mail server to be installed and running, we've told
apt-get not to install the additional recommended packages here.
Let's start with a demonstration of the basic at facilities. First, we specify the time
we want something to occur:
pi@raspberrypi ~ $ at now + 5 minutes
Next, at will enter the command input mode where we enter the commands we
would like to execute, one per line:
at> sox ~/playme.wav -d
at> echo "Finished playing at $(date)" >> ~/at.log
We then press Ctrl + D to signal that we are done with our command list, and we'll
get an output with our job's ID number and the exact time it has been scheduled
to start.
After five minutes have passed, your job will start running in the background. Note
that there won't be any visible output from the application on your console. If you
need to be sure that your command ran, you could write a line to a log file as was
done in the previous example.
Alternatively, you may schedule commands for an exact date and time:
pi@raspberrypi ~ $ at 9am 1 January 2015
Jobs in the queue waiting to be executed can be viewed using the
following command:
pi@raspberrypi ~ $ atq
Once you know the job ID, you can remove it from the queue by replacing # with
your job ID:
pi@raspberrypi ~ $ atrm #
 
Search WWH ::




Custom Search