Cron Expression Cheatsheet
Quick reference for cron syntax covering field syntax, special strings, field values, time examples, system tasks, backup tasks, environment, and troubleshooting
60 commands
* * * * * commandRun every minute (min hour day month weekday)
* * * * * /path/to/script.shcrontab -eEdit current user's crontab
crontab -ecrontab -lList current user's crontab
crontab -lcrontab -rRemove current user's crontab
crontab -rcrontab -u {user} -eEdit crontab for specific user
sudo crontab -u www-data -ecrontab -u {user} -lList crontab for specific user
sudo crontab -u www-data -l/etc/crontabSystem crontab file (with user field)
sudo vi /etc/crontab/etc/cron.d/Additional cron job definition directory
ls /etc/cron.d/@rebootRun once at system startup
@reboot /path/to/startup.sh@yearly / @annuallyRun once a year (Jan 1, 00:00)
@yearly /path/to/yearly-report.sh@monthlyRun once a month (1st, 00:00)
@monthly /path/to/monthly-cleanup.sh@weeklyRun once a week (Sunday, 00:00)
@weekly /path/to/weekly-backup.sh@daily / @midnightRun once a day (00:00)
@daily /path/to/daily-task.sh@hourlyRun once an hour (at :00)
@hourly /path/to/hourly-check.sh* (asterisk)Match all values
* * * * * → every minute, (comma)List multiple values
1,15,30 * * * * → at :01, :15, :30- (hyphen)Range of values
1-5 * * * * → minutes 1 through 5/ (slash)Step values (intervals)
*/5 * * * * → every 5 minutes分: 0-59Minute field range
30 * * * * → at :30 every hour時: 0-23Hour field range
0 9 * * * → at 9:00 AM日: 1-31Day of month field range
0 0 1 * * → 1st of every month月: 1-12 / JAN-DECMonth field range
0 0 1 1 * → January 1st曜日: 0-7 / SUN-SATDay of week range (0 and 7 = Sunday)
0 0 * * 1 → every Monday*/5 * * * *Run every 5 minutes
*/5 * * * * /path/to/check.sh*/15 * * * *Run every 15 minutes
*/15 * * * * /path/to/monitor.sh0 * * * *Run at the start of every hour
0 * * * * /path/to/hourly.sh0 */2 * * *Run every 2 hours
0 */2 * * * /path/to/bihourlyjob.sh0 9 * * *Run daily at 9:00 AM
0 9 * * * /path/to/morning.sh0 9-17 * * 1-5Run hourly 9-17 on weekdays
0 9-17 * * 1-5 /path/to/business-hours.sh30 2 * * *Run daily at 2:30 AM
30 2 * * * /path/to/nightly.sh0 0 * * 0Run every Sunday at midnight
0 0 * * 0 /path/to/weekly.sh0 0 1 * *Run on the 1st of every month
0 0 1 * * /path/to/monthly.sh0 0 1 1 *Run on January 1st every year
0 0 1 1 * /path/to/newyear.sh*/5 * * * * ... >/dev/null 2>&1Run and discard output
*/5 * * * * /path/to/script.sh >/dev/null 2>&10 3 * * * ... >> /var/log/cron.log 2>&1Append output to log file
0 3 * * * /path/to/task.sh >> /var/log/cron.log 2>&10 2 * * * apt-get updateUpdate package list daily at 2 AM
0 2 * * * apt-get update -qq0 4 * * * find /tmp -mtime +7 -deleteDelete temp files older than 7 days
0 4 * * * find /tmp -type f -mtime +7 -delete*/10 * * * * /usr/bin/certbot renewCheck SSL certificate renewal
0 3 * * * /usr/bin/certbot renew --quiet0 6 * * * systemctl restart nginxRestart Nginx daily at 6 AM
0 6 * * * systemctl restart nginx*/2 * * * * /path/to/healthcheck.shRun health check every 2 minutes
*/2 * * * * /path/to/healthcheck.sh0 1 * * * mysqldump ...MySQL backup daily at 1 AM
0 1 * * * mysqldump -u root dbname > /backup/db_$(date +\%F).sql0 2 * * * pg_dump ...PostgreSQL backup daily at 2 AM
0 2 * * * pg_dump -U postgres dbname > /backup/pg_$(date +\%F).sql0 3 * * * tar czf ...Archive directory daily at 3 AM
0 3 * * * tar czf /backup/www_$(date +\%F).tar.gz /var/www0 4 * * * rsync -avz ...Remote sync backup daily at 4 AM
0 4 * * * rsync -avz /data/ user@backup:/backup/data/0 0 * * 0 find /backup -mtime +30 -deleteDelete backups older than 30 days weekly
0 0 * * 0 find /backup -type f -mtime +30 -delete0 5 * * * aws s3 sync ...Sync backup to S3 daily at 5 AM
0 5 * * * aws s3 sync /backup s3://my-bucket/backup/SHELL=/bin/bashSet cron execution shell
SHELL=/bin/bashPATH=...Explicitly set PATH
PATH=/usr/local/bin:/usr/bin:/binMAILTO=user@example.comSet email for cron output
MAILTO=admin@example.comMAILTO=""Disable cron email output
MAILTO=""HOME=/home/userSet home directory
HOME=/home/deployCRON_TZ=timezoneSet cron timezone
CRON_TZ=Asia/Tokyogrep CRON /var/log/syslogCheck cron logs
grep CRON /var/log/syslog | tail -20journalctl -u cronView cron logs via systemd
journalctl -u cron --since todaysystemctl status cronCheck cron service status
systemctl status cronsystemctl restart cronRestart cron service
sudo systemctl restart cronrun-parts --test /etc/cron.d/Test-run scripts in cron.d
run-parts --test /etc/cron.daily/dateCheck server current time
date && timedatectlwhich {command}Check full path of command
which python3env -i /bin/bash -c 'command'Test command in minimal environment
env -i /bin/bash -c '/path/to/script.sh'