Cron service logs
The cron service records the execution of scheduled commands to the server’s system log. The cron service logs can be used to confirm that a scheduled command is executing at the intended times.
View the logs
A server’s cron service logs can be viewed from within the ServerPilot dashboard or through SSH.
Log file location
Log entries for cron are written to the system log that is shared by multiple services:
/var/log/syslog
Log file format
When the cron service runs a scheduled command, three log entries are created.
session opened
— A session was opened to run a scheduled command as the system user that scheduled the command.CMD
— A scheduled command was executed.session closed
— The previously opened session was closed.
The example below shows the three log entries for a scheduled command that was run by the cron service:
Mar 07 17:44:01 example-server CRON[2519523]: pam_unix(cron:session): session opened for user example-user(uid=1000) by example-user(uid=0)Mar 07 17:44:01 example-server CRON[2519524]: (example-user) CMD (wget -q -O - https://example.com/wp-cron.php >/dev/null 2>&1)Mar 07 17:44:02 example-server CRON[2519523]: pam_unix(cron:session): session closed for user example-user
Example commands
You must be logged in as root
to view the cron service logs.
View recent cron service log entries
Show the most recent 100 commands executed by the cron service.
grep CRON /var/log/syslog | grep CMD | tail -n 100