Question
Is there a method to determine if a cronjob ran twice?
Answer
Yes. It would require cross-referencing the "date", "time" and "command" in the /var/log/cron* file.
For example, let say you created a cronjob to run at noon daily with the command "/usr/local/bin/php -m > /file/php-modules"
Log into the cPanel Interface for your domain, and go to the following location:
cPanel: Home -> Advanced -> Cron Jobs
Using the interface, create the following cronjob.
0 12 * * * /usr/local/bin/php -m > /file/php-modules
For the next step, you must log into the server as the 'root' user. If you are unable to become 'root' on the server, you will want to reach out to your server administrator for assistance with the next section.
To view the logs for cron, first, log into SSH as the root user and run the following command:
grep "/usr/local/bin/php -m > /file/php-modules" /var/log/cron
Replace the part in the double-quotes with your cronjob command.
The output you get would look similar to this:
/var/log/cron:APR 01 04:30:01 srv002 CROND[1145]: (cptest) CMD (/usr/local/bin/php -m > /file/php-modules)
/var/log/cron:APR 01 04:30:01 srv002 CROND[1278]: (cptest) CMD (/usr/local/bin/php -m > /file/php-modules)