CRON

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 23:31, 29 May 2006 (edit)
68.8.18.103 (Talk)
(crontab howto)
← Previous diff
Revision as of 23:32, 29 May 2006 (edit) (undo)
68.8.18.103 (Talk)

Next diff →
Line 11: Line 11:
== Restarting Cron == == Restarting Cron ==
-After you modify/add the appropriate command you will need to restart cron. You can restart cron with the following command: +After you modify/add the appropriate command you will need to restart cron in order for your changes to take effect. You can restart cron with the following command:
killall -9 cron; cron killall -9 cron; cron

Revision as of 23:32, 29 May 2006

The crontab command, found in Unix and Unix-like operating systems, is used to schedule commands to be executed periodically. Dreamhost crontab wiki has a good explanation of how crontab works.


Crontab locations in DD-WRT

Crontab can be set in two locations on dd-wrt:

1. Either by putting your command in the /tmp/crontab file

2. Or by putting a file in the /tmp/cron.d/ folder (eg. /tmp/cron.d/dosomething) that holds your command


Restarting Cron

After you modify/add the appropriate command you will need to restart cron in order for your changes to take effect. You can restart cron with the following command:

killall -9 cron; cron


Extras

You may wish to add this to your startup script, before any jobs are added. It will add clarity to your crontab file:

echo '# minute (0-59),' >> /tmp/crontab
echo '# |      hour (0-23),' >> /tmp/crontab
echo '# |      |       day of the month (1-31),' >> /tmp/crontab
echo '# |      |       |       month of the year (1-12),' >> /tmp/crontab
echo '# |      |       |       |       day of the week (0-6 with 0=Sunday).' >> /tmp/crontab
echo '# |      |       |       |       |       commands' >> /tmp/crontab

If you add this to your startup script, you will see this in your crontab file:

# minute (0-59),
# |      hour (0-23),
# |      |       day of the month (1-31),
# |      |       |       month of the year (1-12),
# |      |       |       |       day of the week (0-6 with 0=Sunday).
# |      |       |       |       |       commands