introductioninstalling redhatunix commandsediting filesssh
sitemapapacheftptcp/ipmisc-notesresources

crontab notes:

Creating a cron job to automate tasks to be run at predefined intervals (hourly, daily, monthly etc.) can be usefull for mirroring another server or rotating log files.

To start you need to create a script you want to run.  If your just curious you can make a script that copies one folder to another forlder recursively as a test.

Open vi, pico or your favorite text editor and type the following script.

#!bin/sh
#this is a test for cron using the cp command as a demo
export PATH=you need to put the path of the user that the cronjob will run as here
/usr/bin/cp –a /test/folder/to/be/copied/goes/here /folder/to/copy/to/goes/here

note: If you do not know how to get your path, you can have your path printed onscreen by "$ echo $PATH". This will print your path to the terminal that you are working from. Now just cut and paste.

Available time/date fields and the ranges of values for each field are shown here. A time/date field can contain an asterisk instead of a number. An asterisk indicates that any value should be matched.

Field Allowed values

---------- ------------------------

minute 0-59

hour 0-23

day 0-13

month 0-12

day of week 0-7 (0 & 7 being Sunday)

30 12 * * * /somescriptnamegoeshere

This would run a script at 12:30 every day

30 12 * * 1 /somescriptnamegoeshere

This would run a script at 12:30 every Monday