Godaddy Hosting Cron Job Timezone setting
Asked Answered
S

3

7

I'm using godaddy hosting and running cron job for codeigniter. That will be running every day at 10am. So in cron tab i tried like this

00 10 * * * export TZ=Asia/Dhaka; wget http://www.example.com/function

00 10 * * * TZ=Asia/Dhaka; wget http://www.example.com/function

00 10 * * * export TZ=Asia/Dhaka; /usr/bin/curl "http://www.example.com/function"

Always those command executing on others timezone maybe UTC timezone but i need Asia/Dhaka timezone UTC +6:00.

How do i write correct timezone command and where to write it?

Godaddy Cron Tab Look Like this enter image description here

Sacerdotalism answered 6/8, 2016 at 5:25 Comment(0)
F
2

If you're using PHP, you can figure out both what time is it at your server and in what timezone you're at:

echo date('c');

It'll output something like:

2017-08-15T02:40:09+00:00

Faunie answered 15/8, 2017 at 2:41 Comment(0)
K
2

The above answers didn't help me, they both gave me the date / time for the domain, but not for cron job. What helped me to determine the cron job schedule is:

  1. Take your IP address from cpanel
  2. Google where it's located by searching IP xxx.xxx.xxx.xxx
  3. Google time in that city / country
  4. You have determined your timezone
Kaminski answered 11/11, 2017 at 13:35 Comment(2)
I had the exact same issue, and this solution worked perfectly for me. The server showed UTC as timezone in phpinfo(), but the cron timezone turned out to be UTC-7, based on my cronjob tests. Thank you very much!Haywire
Yeah it's a tricky one, no clear documentation. Glad to help, thanks for voting upKaminski
C
0

C-Panel cron job manager does not show the current time at the server. When account is set up, it is done on a specific server that resides in a specific timezone. You need to find out what that timezone is and then set the schedule based on that timezone. You can run a

echo date("D M d, g:i A", time()) 

function in php to tell you. Then set your schedule.

Collide answered 2/10, 2016 at 4:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.