Cron Cheatsheet

Tags: linux

Edit Crontab

crontab -e

Line format

1 2 3 4 5 command

Patterns

Pattern Matches
23 Exactly 23
* Any number
*/20 Any number divisible by 20
8-17 Any number in the range 8-17

Examples

Block reddit using pihole except between 8pm and 10pm daily

0 20 * * * /usr/local/bin/pihole -b -d reddit.com www.reddit.com
0 22 * * * /usr/local/bin/pihole -b reddit.com www.reddit.com

Common problems