Using cron jobs in CentOS

I spent more than 5 hours, today, trying to make a cron job on my company web server. So, after numerous tries, I was almost ready to give up, but finally I found that even the manual say that you should not restart the crond daemon after you add a new cronjob in the crontab, because the crond daemon check every minute for changes in the crontab file and if there are any changes it run the new added cron jobs. This entry in the manual is not always true. So if you have made a cron job and in the /var/log/cron file you don’t see an entry at the time when your job was scheduled, and assuming that you are running a valid Unix command like ‘ls’, try to restart your crond daemon ( /etc/init.d/crond restart ) after adding a new cron job.

A cron job is very usefull and it saves you a lot of time when you have to do a periodic operation. If you want to perform more then one operation at some period of time use a shell script because is easy to debug and you don’t need to change the cron job if you want to add/remove operations.

Note. If you want to start a GUI application in you current display, with a cron job, first of all run an echo $DISPLAY to check you environment var value. In some cases  this variable can have a different value than 0.0  and always use the absolute path.