First you will need to install cron on the system. Type the following to install cron in CentOS 6.
yum install vixie-cron
Set cron to start when the system starts by executing chkconfig.
chkconfig crond on servcie crond start
Now that cron has been installed on the system you can add tasks to your cron tab. The crontab file is located in /etc/crontab (This is a file with no extension, not a folder). The file might contain something like this.
SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ # Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # | | | | | # * * * * * user-name command to be executed
To make your life very easy there is a tool that will generate the crontab line for you. Use the form to setup frequency you want the task to run and it will provide you with the line of code that you add to your crontab file.