Blog Image

Timezone issue with cron

If your cron job timing does’t match with the server time zone for example. You have set the cron to run at 12:30 PM, but when you see the cron log the time show say 3:40 PM. So to run your cron job as per your time zone Say if you are in India, your cron job should run as per Indian time. So you have to add the following line before your cron job line.

CRON_TZ=”Asia/Kolkata” ## This is the important line
03 18 * * * wget http://www.abc.com/test.php >> /var/www/html/abc/logs/test-`date +\%Y\%m\%d`.log

`date +\%Y\%m\%d` => This will create the log as per date month and year wise. Date format enclosed by tick (`) sign



Author: admin

Vinod Ram has been in Software Industry since 2006 and has experience of over 16 years in Software Development & Project Management domain specialised majorly in LAMP stack & Open Source Technology, building enterprise level Web based Application, Large Database driven and huge traffic Websites and Project Management. He loves to write information articles and blog to share his knowledge and experience with the outside world and help people to find solution for their problems.