Crontab - a quick glance

DevOps Apr 30, 2021

crontab is a powerful tool for automation. One of the most common usages nowadays is certification renewal, no matter using certbot or acme.sh.

Edit task

Edit crontab for current user

crontab -e

Edit crontab for root user

sudo crontab -e

Edit crontab for specific user

crontab -u <username> -e

List task

crontab -l is used for this purpose

Test crontab rules

crontab.guru could be used for this purpose, which provides a nice visualized interface for either beginners or advanced users.

Crontab.guru - The cron schedule expression editor
An easy to use editor for crontab schedules.

The following examples can also be used for quick reference

Cron examples - Crontab.guru

Check if tasks are executed correctly

grep -i cron /var/log/syslog

Tags

Sophie Cao

(she/they, elle/iel, 她/佢)