Hi folks.
Call me captain obvious, but I've just figured out how to work cron / crontab in SME server and I'd like to share the info with the world. Maybe it will save someone some time?
There's a userpanel crontab manager available here:
http://www.vanhees.cc/modules.php?op=modload&name=Downloads&file=index&req=viewsdownload But if you want to create more detailed cron jobs - ie one that runs every 5 minutes, then read on...
Create a new file in /etc/cron.d/ :
pico /etc/crond/newfile.cron
Then insert some lines in the textfile that correspond to the options that you want:
The format of the crontab file is as follows:
Minute(0-59) Hour(0-23) Day of Month(1-31) Month(1-12 or Jan-Dec) Day of Week(0-6 or Sun-Sat) User Command
You can use x,y,z to specify multiple options of the same time unit.
You can use * to specify all.
You can use */x format (see examples for explanation of how this works)
eg:
59 17 1,10,20,30 * * root /home/username/backupsite
This would execute the task on the 1st, the 10th, the 20th and on the 30th of each month, at 17:59PM.
59 17 * * 1-5 root /home/username/backupsite
This would execute the cron job on weekdays only.
59 */6 * * * root /home/username/backupsite
Here, the tasks is executed every 4 hours (24/6 =4).
(thanks to
http://www.clockwatchers.com/cron_advanced.html for examples)
So, add the lines to your newfile.cron file with pico and save it.
Now, you have to execute the following command to integrate it into the crontab manager:
crontab -u root /etc/cron.d/
And that's it!
Cheers,
Silas.