pragmatism first

SNOOZE(1) - Linux manual page online | User commands

Run a command at a particular time.

January 4, 2016
SNOOZE(1) BSD General Commands Manual SNOOZE(1)


snooze — run a command at a particular time


snooze [-nv] [-t timefile] [-T timewait] [-R randdelay] [-s slack] [-d day] [-m mon] [-w wday] [-D yday] [-W yweek] [-H hour] [-M min] [-S sec] command ...


snooze waits until a particular time and then runs a command. Together with a service supervision system such as runsv(8), this can be used to replace cron(8). The options are as follows: -n Dry run: print the next 5 times the command would run and exit. -v Verbose: print scheduled (and rescheduled) times. -t, -T See below, TIMEFILES. -R Wait randomly up to randdelay seconds later than the scheduled time. -s Commands are executed even if they are slack (default: 60) seconds late. The durations randdelay and slack and timewait are parsed as seconds, unless a postfix of m for minutes, h for hours, or d for days is used. The remaining arguments are patterns for the time fields: -d day of month -n month -w weekday (0-7, sunday is 0 and 7) -D day of year (1..366) -W ISO week of year (1..53) -H hour -M minute -S second The following syntax is used for these options: -d 3 exact match: run on the 3rd -d 3,10,27 alternation: run on 3rd, 10th, 27th -d 1-5 range: run on 1st, 2nd, 3rd, 4th, 5th -d * star: run every day -d /5 repetition: run on 5th, 10th, 15th, 20th, 25th, 30th day -d 2/5 shifted repetition: run on 7th, 12th, 17th, 22nd, 27th day and combinations of those, e.g. -d 1-10,15/5,28. The defaults are -d* -m* -w* -D* -W* -H0 -M0 -S0, that is, every midnight. Note that all patterns need to match (contrary to cron(8) where either day of month or day of week matches), so -w5 -d13 only runs on Friday the 13th. If snooze receives a SIGALRM signal, the command is immediately executed.


Optionally, you can keep track of runs in time files, using -t: When -T is passed, execution will not start earlier than the mtime of timefile plus timewait seconds. When -T is not passed, snooze will start finding the first matching time starting from the mtime of timefile, and taking slack into account. (E.g. -H0 -s 1d -t timefile will start an instant execution when timefile has not been touched today, whereas without -t this would always wait until next midnight.) If timefile does not exist, it will be assumed outdated enough to ensure earliest execution. snooze does not update the timefiles, your job needs to do that! Only mtime is looked at, so touch(1) is good.


The snooze utility exits 0 on success, and >0 if an error occurs. The command is run using exec, so its exit status gets propagated to the parent. If no command was given, snooze just returns with status 0.


runwhen(1), sleep(1), uschedule(1), cron(8)


Leah Neukirchen <>


snooze is in the public domain. To the extent possible under law, the creator of this work has waived all copyright and related or neighboring rights to this work.
BSD January 4, 2016 BSD
This manual Reference Other manuals
snooze(1) referred by
refer to cron(8) | runsv(8) | sleep(1) | touch(1)
Download raw manual
Index BSD General Commands Manual (+423) BSD (+3984) № 1 (+39907)
Go top