Cron crontab HOWTO for sme server

sme versions supported: 6.x.x

Author: Ray Mitchell - mitchellcpa_AT_yahoo.com.au

Release Date: 1 November 2005 v1.0

Version: 1.0

 

Contributors

The information contained in this HOWTO was obtained from a forum post by silasp at

http://contribs.org/modules/pbboard/viewtopic.php?t=29433

with some minor changes & tidying up as required. Thanks also for examples to http://www.clockwatchers.com/cron_advanced.html for examples.

 

Instructions

There is a userpanel crontab manager available here:

http://www.vanhees.cc/modules.php?op=modload&name=Downloads&file=index&req=viewsdownload&sid=35

Download that to an empty folder

change to that folder ie

cd /path/folder

and install using

rpm -Uvh *.rpm

and configure as required using the server manager panel

 

If you want to create more detailed cron jobs - ie one that runs every 5 minutes, 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)

example1:

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.

example2:

59 17 * * 1-5 root /home/username/backupsite

This would execute the cron job on weekdays only.

example3:

59 */6 * * * root /home/username/backupsite

Here, the tasks is executed every 4 hours (24/6 =4).

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/