Skip to content

Using Cron

Cron is a system daemon that is used to schedule jobs, tasks, and recurring system calls---often referred to as a cron job. Jobs are encoded in a cron table, which can be found at /etc/crontab. When working with the CLI, it's typically best to adjust files via the crontab utility rather than writing to the file directly.

crontab -l

  • List the configured cron table for the current user.

crontab -e

  • Edit the current cron table.
  • Hint: use crontab guru to help write cron expressions.

If you append sudo to the above commands you will get the root user's cron table instead of the current user. They run seperately.

Observing your cron jobs

Ensure the cron service is running

sh
systemctl status cron
systemctl start cron # if you need to start the service
systemctl status cron
systemctl start cron # if you need to start the service

Check to see if the intended processes spawned by cron are running

sh
ps aux | grep <process spawned by cron>
ps aux | grep <process spawned by cron>
ADDITIONAL RESOURCES