All Collections Apps Cron Jobs

Cron Jobs

Applications can define cron jobs to run recurring tasks at scheduled times

Updated

Cron jobs are an important piece of building applications that need work done on a recurring schedule.

Hatchbox configures cron jobs to use

Debugging cron jobs

Cron is a long-running process built-in to the OS. You can view the cron logs to see what times it executes the cron job commands.

To view the cron logs:

journalctl -u cron

To follow live cron logs:

journalctl -u cron -f

To filter to the deploy user's cron jobs:

journalctl -u cron -g "\(deploy\) CMD"

Cron doesn't capture the output of commands it executes, so you may want to write the job's output to a file. You can update your cron job to append logs to a file and use 2>&1 to capture both stdout and stderr:

my-command >> /home/deploy/cron.log 2>&1