Introduction
This article provides the steps to determine if the same cron job was run twice.
Procedure
- Access the server's command line as the 'root' user via SSH or "Terminal" in WHM.
- List the user's cron jobs.
crontab -l -u $username
Please note that "$username" must be replaced with the cron owner's username. - Copy the command run in the cron job.
0 12 * * * /usr/local/bin/php -m > /file/php-modules
- Search the cron log for the user and the command.
grep "/usr/local/bin/php -m > /file/php-modules" /var/log/cron|grep cptest
Please note that "/usr/local/bin/php -m > /file/php-modules" and "cptest" must be replaced with the command found in the user's crontab and the user's username. - Look for entries with the same timestamp.
APR 01 04:30:01 srv002 CROND[1145]: (cptest) CMD (/usr/local/bin/php -m > /file/php-modules)
APR 01 04:30:01 srv002 CROND[1278]: (cptest) CMD (/usr/local/bin/php -m > /file/php-modules) - Compare the PIDs. If the PIDs are different, the cron ran twice.
Please note that the PID is the number in brackets after CROND.
Comments
0 comments
Article is closed for comments.