Difference between revisions of "Cron Service"
From Wiki for Dragino Project
Line 1: | Line 1: | ||
Dragino supports cron service which you can schedule your task to be executed periodically. | Dragino supports cron service which you can schedule your task to be executed periodically. | ||
− | Steps to set cron service | + | =Steps to set cron service= |
*create file: '''/etc/crontabs/root''' | *create file: '''/etc/crontabs/root''' | ||
*modify /etc/crontabs/root for scheduling task, below is the format and example | *modify /etc/crontabs/root for scheduling task, below is the format and example | ||
#run script /root/test at 10 every hour | #run script /root/test at 10 every hour | ||
− | #format [ | + | #format [min] [hour] [day of month] [month] [day of week] [program to be run] |
10 * * * * /bin/sh /root/test | 10 * * * * /bin/sh /root/test | ||
− | *restart | + | *restart cron service |
root@dragino-1a7f76:~# /etc/init.d/cron restart | root@dragino-1a7f76:~# /etc/init.d/cron restart | ||
+ | |||
+ | =Explaination for 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. | ||
+ | |||
+ | Ev |
Revision as of 02:24, 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 for 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.
Ev