Managing Cron Jobs
Cron is a time-based job scheduler in Unix-like operating systems. You can use cron jobs to automate repetitive tasks.
Editing the Crontab
The easiest way to manage cron jobs for the current user is by editing the crontab file:
crontab -e
CopyCron Job Syntax
A cron job has five time-and-date fields, followed by the command to be run:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday)
# │ │ │ │ │
# * * * * * command_to_execute
CopyExample: Run a backup script every day at 3:30 AM:
30 3 * * * /path/to/your/backup-script.sh
Copy