Crontab Time String Syntax

schtasks is my goto workhorse for scheduleing tasks in windows environment and on mac and raspberrypi, crontab is an excellent choice.

I use crontab a lot in lot of the things I do in raspberry, but I keep forgetting the cron time sting syntax, so here’s one that I have kept as a reference

The Cron time string is five values separated by spaces, based on the following information:

Character Descriptor Acceptable values

1 Minute 0 to 59, or * (no specific value)
2 Hour 0 to 23, or * for any value. All times UTC.
3 Day of the month 1 to 31, or * (no specific value)
4 Month 1 to 12, or * (no specific value)
5 Day of the week 0 to 7 (0 and 7 both represent Sunday), or * (no specific value)

Cron time string Description

30 * * * * Execute a command at 30 minutes past the hour, every hour.
0 13 * * 1 Execute a command at 1:00 p.m. UTC every Monday.
*/5 * * * * Execute a command every five minutes.
0 */2 * * * Execute a command every second hour, on the hour.

Posting it here for my reference. Hope others will find it useful

Advertisement

One thought on “Crontab Time String Syntax

  1. Pingback: Reboot Raspberry Pi Every Time on Schedule | SukhbinderSingh.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s