Difference between revisions of "Cron Service"

From Wiki for Dragino Project
Jump to: navigation, search
(Explaination for the time format)
Line 10: Line 10:
 
  root@dragino-1a7f76:~# /etc/init.d/cron restart
 
  root@dragino-1a7f76:~# /etc/init.d/cron restart
  
=Explaination for the time format=
+
=Explaination of the time format=
 
Variable Range:
 
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.
+
  [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.
+
  [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.
+
  [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.
+
  [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.
+
  [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.
+
  [program]   Program to be executed. Include full path information.
  
 
Ev
 
Ev

Revision as of 02:25, 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.

Ev