|
The functions described here may differ slightly in the syntax and structure depending on the Linux distribution used!
You can check whether the CRON daemon is running by using the following command:
If CRON is active, Linux replies with one or more lines, beginning with the user name (e.g. root) and a few other pieces of information.
As already mentioned, the controlling element with CRON is the crontab file, which can be found in the directory /etc. Here you specify which action needs to be performed. For each action there is a line with a specified structure.
#m h dom mon dow user command
0 8 * * 1-5 root curl "10.40.22.101/outputaccess1?PW=Password&State=ON&" |
|
|
|
: |
Minute possible values: 0-59 |
|
|
: |
Hour possible values: 0-23 |
|
|
: |
Day of the month possible values: 1-31 |
|
|
: |
Month possible values: 1-12 |
|
|
|
Day of the week possible values: 0-6 (beginning with 0 = Sunday, 1 = Monday, ...) |
|
|
|
User name (it is recommended that you use root as the user name |
|
|
: |
Command for switching using Web-IO curl and the switching invoke |
Instead of a time parameter you may use an asterisk *. This stands for always, i.e. for all permitted values (for example every minute).
Numerical ranges are permitted. Ranges are two numbers separated by a hyphen. The specified limits are inclusive. For example, 8-17 as an hour value causes the action to be performed at 8, 9, 10, 11, 12, 1, 2, 3, 4 and 5 o’clock.
Lists are possible. A list is an quantity of numbers or ranges separated by commas. Examples: 1,2,5,9 or 0-4,8-12.
Increments can be used in combination with ranges. Behind the range specify the "/<Increment>".
Example: "0-23/2" can be used under hours to run a special command every two hours. The alternative would be: 0,2,4,6,8,10,12,14,16,18,20,22. Increments are also allowed after asterisks *, "every two hours" can also be described by "*/2".
The entry shown above turns Output 1 on at 8:00 in the morning every Monday through Friday.
The CRON format may seem somewhat cumbersome at first glance, but it is quite easy to configure both repetitive actions as well as one-time switching actuations.
A final example:
You want to turn the courtyard lighting at a company on each evening and off the next morning. Output 0 on the Web-IO 10.40.22.101 controls a Coupling relays which powers the lighting. To save electricity, the controller needs to take into account the monthly sunrise and sunset times. In addition, Output 1 on the Web-IO 10.40.22.104 should activate the break announcer Mondays through Fridays at 1:00 p.m. (the output has been configured for 500ms pulse operation, i.e. automatically resets).
|
#m h dom mon dow user command
#January 16:30 - 9:30
30 16 * 1 * root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
30 9 * 1 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#February 17:30 - 8:30
30 17 * 2 * root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
30 8 * 2 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#March 18:30 - 8:00
30 18 * 3* root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
0 8 * 3 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#April 20:00 - 7:30
0 20 * 4 * root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
30 7 * 4 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#May 21:00 - 5:30
0 21 * 5 * root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
30 5 * 5 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#June 21:30 - 5:00
30 21 * 6 * root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
0 5 * 6 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#JJuly 21:30 - 6:00
30 21 * 7 * root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
0 6 * 7 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#August 18:30 - 7:30
30 18 * 8* root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
30 7* 8 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#September 17:30 - 7:00
30 17 * 9 * root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
0 7 * 9 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#October 17:00 - 7:30
0 17 * 10 * root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
30 7 * 10 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#November 16:30 - 8:30
30 16 * 11 * root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
30 8 * 11 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#December 16:00 - 9:00
0 16 * 12 * root curl "10.40.22.101/outputaccess0?PW=Password&State=ON&"
0 9 * 12 * root curl "10.40.22.101/outputaccess0?PW=Password&State=OFF&"
#Monday - Friday 13:00
0 13 * * 1-5 root curl "10.40.22.104/outputaccess1?PW=Password&State=ON&
|
|
The example shows that even complex switching routines can be handled using just a few lines of configuration.
|