Difference between revisions of "Cron Service"
From Wiki for Dragino Project
(→Explaination of the time format) |
(→Explaination of the time format) |
||
Line 33: | Line 33: | ||
|} | |} | ||
− | + | Use Operators: | |
− | + | {| class="wikitable" border="1" align="center" | |
+ | |- | ||
+ | ! Operator | ||
+ | ! Function | ||
+ | |- | ||
+ | | Asterisk (*) | ||
+ | | Specifies all possible values for this field | ||
+ | |- | ||
+ | | Comma (,) | ||
+ | | Specifies a list of value for this field, for example, 1,5,6,8,10 | ||
+ | |- | ||
+ | | Dash (-) | ||
+ | | Specifies a range of value for this field, for example: 1-5 | ||
+ | |- | ||
+ | | Slash(/) | ||
+ | | Per , for example, */5, every 5 (minutes) | ||
+ | |} |
Revision as of 02:42, 2 May 2012
Dragino supports cron service which you can schedule your task to be executed periodically.
Steps to set cron service
- create file: /etc/crontabs/root
- modify /etc/crontabs/root for scheduling task, below is the format and example
#run script /root/test at 10 every hour #format [min] [hour] [day of month] [month] [day of week] [program to be run] 10 * * * * /bin/sh /root/test
- restart cron service
root@dragino-1a7f76:~# /etc/init.d/cron restart
Explaination of the time format
Variable Range:
[min] | Minutes that program should be executed on. 0-59. Do not set as * or the program will be run once a minute. |
[hour] | Hour that program should be executed on. 0-23. * for every hour. |
[day of month] | Day of the month that process should be executed on. 1-31. * for every day. |
[month] | Month that program whould be executed on. 1-12 * for every month. |
[day of week] | Day of the week. 0-6 where Sunday = 0, Monday = 1, ...., Saturday = 6. * for every day of the week. |
[program] | Program to be executed. Include full path information. |
Use Operators:
Operator | Function |
---|---|
Asterisk (*) | Specifies all possible values for this field |
Comma (,) | Specifies a list of value for this field, for example, 1,5,6,8,10 |
Dash (-) | Specifies a range of value for this field, for example: 1-5 |
Slash(/) | Per , for example, */5, every 5 (minutes) |