Cron firing at Wrong Time

Hi Everyone.

I have a problem with my cron setting and can’t figure out where the issue is. I moved my domain from cpanel to Virtualmin and it works great, but in cpanel I had 2 crons that would run at the correct times…virtualmin runs them almost 8 hours early. I have a 5 minutes cron, but that works fine since it goes by minutes.

So far I checked the server time, reset the server time, checked my any software related to the product…nothing works. I’m using a vps and my timezone is America/New_York, and when I run the “date” command it shows the correct date and time.

Thank You for any help or suggestions ahead of time.

M

Howdy,

virtualmin runs them almost 8 hours early

Well, Virtualmin doesn’t run Cron jobs – cron does.

So if they aren’t running at the correct times, that generally means one of two things:

  1. They aren’t listed in the crontab correctly

  2. The system time is incorrect

It sounds like you’ve checked your system time already, so that’s good.

You may want to look at the crontab for that user, and verify that it’s setup correctly in there.

-Eric

Thanks Eric.

Sorry I meant Scheduled Jobs :slight_smile:

The tasks are whmcs commands. It’s a command line that is in put into scheduled tasks/cron jobs, and runs when the time comes.

One command runs every 5 minutes. It’s set as 5,10,15,20… in the scheduled jobs.

The second command I set for 12pm. I believe it ran around 4am. In cpanel’s cron job, a 12pm task would run at 12pm.

So I’m a bit lost since the 5 minute Scheduled jobs run every 5 minutes as it should…but anything set for a specific hour seems to be random.

Howdy,

The Schedules Jobs is just editing the cron tab… so what we could do is review the resulting cron file and see if it looks correct.

To do that, you can run this command:

crontab -u USERNAME -l

That will show all cron jobs for the user “USERNAME”.

When doing that, does it appear to be what you’d expect?

Feel free to paste that information into here, then we can see if everything looks correct.

-Eric

Hi Eric,

The information from the command is correct as these are the times I set within the control panel.

Here is the info from the command you gave me

[root@xxx /]# crontab -u xxxxxx -l
MAILTO=""
0,5,10,15,20,25,30,35,40,45,50,55 * * * * php -q /home/xxxxxx/public_html/abc/pipe/pop.php
55 14 * * * php -q /home/xxxxxx/public_html/abc/123/def/456/netearthonesync.php
0 15 * * * php -q /home/xxxxxx/public_html/abc/123/cron.php
[root@server7 /]# date
Tue Jul 31 07:17:18 EDT 2012
[root@xxxx /]#

The date command shows the correct time and date;

  1. the netearthone command I set to run at 2:55pm, it ran at 6:55 am
  2. the cron command I set to run at 12:15am, it ran at 7:30 am

Worst case, I could set the times in accordance to how the system is reading the time, but I shouldn’t have to.

Anyone have any possible idea or suggestions?