07.06.2014 Views

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Be careful, however, if the order in which the different scheduled tasks and<br />

the delay between their respective executions maers, you should check the<br />

compatibility of these constraints with cron's behavior; if necessary, you can<br />

prepare a special schedule for the two problematic nights per year.<br />

Each significant line of a crontab describes a scheduled command with the six (or seven) following<br />

fields:<br />

• the value for the minute (number from 0 to 59);<br />

• the value for the hour (from 0 to 23);<br />

• the value for the day of the month (from 1 to 31);<br />

• the value for the month (from 1 to 12);<br />

• the value for the day of the week (from 0 to 7, 1 corresponding to Monday, Sunday being<br />

represented by both 0 and 7; it is also possible to use the first three letters of the name of<br />

the day of the week in English, such as Sun, Mon, etc.);<br />

• the user name under whose identity the command must be executed (in the /etc/<br />

crontab file and in the fragments located in /etc/cron.d/, but not in the users' own<br />

crontab files);<br />

• the command to execute (when the conditions defined by the first five columns are met).<br />

All these details are documented in the crontab(5) man page.<br />

Each value can be expressed in the form of a list of possible values (separated by commas). The<br />

syntax a-b describes the interval of all the values between a and b. The syntax a-b/c describes<br />

the interval with an increment of c (example: 0-10/2 means 0,2,4,6,8,10). An asterisk * is a<br />

wildcard, representing all possible values.<br />

#Format<br />

#min hour day mon dow<br />

command<br />

# Download data every night at 7:25 pm<br />

25 19 * * * $HOME/bin/get.pl<br />

# 8:00 am, on weekdays (Monday through Friday)<br />

00 08 * * 1-5 $HOME/bin/dosomething<br />

206 The Debian Administrator's Handbook

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!