How to debug cron


Scheduled Tasks/Cron jobs can unexpectedly stop running for a number of reasons. If this occurs, you will see the following notice in your Admin Dashboard:


"Your scheduled task is not running or has crashed. This means important routines like email processing and escalations are not running."

We have outlined steps explaining how to manually obtain verbose logging output from cron jobs for Windows and Linux Operating Systems below.  You can manually run the task from the command-line to see the output.

 

Run scheduled task manually on Windows:

 

1) First, disable your Windows Scheduled Task. If you don't disable the system task, then it's possible you will try to run the task at the same time as your server.

 

2) After disabling the scheduled tasks, wait a few minutes to let any existing tasks finish. You should double-check running processes to ensure no tasks are still running in the Task Manager on Windows.

 
3)
Finally, run the cron command manually:

cd /path/to/deskpro

php.exe bin\cron --verbose -f

 

You may need to specify the full path to php.exe. e.g. run:

"C:\Program Files (x86)\PHP\v7.0\php.exe" bin\cron --verbose -f

 

If you want to save the output to a file, you can redirect it like so:

php bin/cron --verbose -f > cron-log.txt



Run cron task manually on Linux:

 

1) First, disable your Linux cron job. If you don't disable the system task, then it's possible you will try to run the cron job at the same time as your server.


2) After disabling the system cron job, wait a few minutes to let any existing tasks finish. You should double-check running processes to ensure no tasks are still running. For example:

ps aux | grep 'bin/cron'

 

3) Finally, run the cron command manually:

cd /path/to/deskpro

php bin/cron --verbose -f


If you want to save the output to a file, you can redirect it like so:

php bin/cron --verbose -f | tee > cron-log.txt

Helpful Unhelpful

29 of 63 people found this page helpful

Add a comment

You need to log in before you can submit a comment.

Need a password reminder?