2

I have only one cron configured in cPanel for WHMCS to run once per day at 12.00 AM.

The cron sends daily activity logs to my email.

A problem came up recently in which cron job activity logs sent to me from that email [email protected] which does not exist. Emails are coming from that address without replacing my actual domain name.

So I deleted the cron job, I created a new one with different timing 8.00 AM. The cron runs correctly at that time and I'm receiving logs from my valid email. However, I still get emails at 12.00 AM too, as If there is another cron job stuck at that time and the logs are coming from that invalid email address [email protected].

I looked into the cron configuration file and there were no duplicate entries for crons. I checked with WHMCS support and the software configuration is correct.

Have anyone had a problem like this before? Any suggestions please? Thank you.

1
  • How did you set up your cron job in the first place? Type: crontab -l into you terminal and see what comes up, it should list all your cron jobs.
    – Badr Hari
    Commented Jan 18, 2015 at 15:54

2 Answers 2

1

Also, when you check the cron jobs for every user, check the first few characters in each line of the cron file.

If the first set of characters start with either "0 0" or "00 00" or two sets of zeros in any form, then it means midnight. The later numbers help define how many midnights the task is supposed to happen. so if the remaining characters are space-separated stars followed by a command, then that command is executed every midnight (12 AM).

Also, check your crontabs before and after using cpanel (and especially after using cpanel), because cpanel is likely overwriting your crontab after saving settings (in cpanel). In a unix shell as root, you can switch users with this command:

su <insert username>

Then check and edit the crontab for that user like this:

crontab -e

also check the entire etc folder for other cron files that start with cron by typing:

ls /etc/cron*.*
0

Cron jobs can be installed in multiple locations. Make sure you check all of them. My server has a /etc/cron.d/ and /etc/cron.daily directory where cron jobs can be installed. Each user also can install jobs with the crontab command. (crontab -l will list all jobs for a particular user). You might want to try the solutions in this StackOverflow question about listing the cron jobs for all users.

When a cron job runs, a log entry gets posted to /etc/log/syslog that might look something like:

Jan 18 07:42:01 mybox CRON[26066]: (root) CMD (/root/cronjobs/check)

That could tell you when the job ran and with what user.

You could also try restarting the cron daemon with a command like:

sudo service cron restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.