_                    _
  ___ | |__   __ _ _______ | |_
 / _ \| '_ \ / _` |_  / _ \| __|
| (_) | | | | (_| |/ / (_) | |_
 \___/|_| |_|\__,_/___\___/ \__|

crontabconfig and usage

-e : edit
-l : list

This applies to the user crontab, the system crontab is /etc/crontab.

MINUTE HOUR DAY_OF_MONTH MONTH DAY_OF_WEEK COMMAND

The fields MINUTE, HOUR, DAY, MONTH, DAY_OF_WEEK can have the following values:

- Numeric: MINUTE (0-60), HOUR (0-23), DAY_OF_MONTh (1-31), MONTH (1-12), DAY_OF_WEEK (0-6).
The week starts on Sunday with the value 0.
- Asterisk: * means it executes every MINUTE, HOUR, DAY, MONTH, DAY_OF_WEEK depending on the field where it is set.
- Text: The first 3 letters of the name of the month or day of the week. It is case-insensitive. MONTH (Jan-Dec), DAY_OF_WEEK (Sun-Sat).
- Ranges: Example, using 15-30 for MINUTE will run every minute between the minutes 15 and 30.
- Lists: Values can be separated by comma, example: DAY_OF_WEEK Mon,Wed to run on Mondays and Wednesdays.
- Frequency: specified as /NUMBER, example: */10 will run every 10 minutes.
- The options can be combined, example: MINUTE 15-30/5,45 will run every 5 minutes between the minutes 15 and 30 and will also run at minute 45.
- The command can be a command or command chain.

15 5-10 * * 1 5 date > log

This will output date to the file log Monday through Friday 15 minutes after the hour between 5am and 10am any day of the month all months.

(back to top)

To ensure crontab can execute the command, use the full path of the command, which can be found using the command whereis, and full path for files and directories.

$ whereis date
OpenBSD output : /bin/date
linux output : date: /usr/bin/date /bin/date /usr/man/man1/date.1.gz
15 5-10 * * 1 5 /usr/bin/date > /home/user/log

Some environment variables may not be found, environment variables can be set at the beginning of the crontab file. Example:

HOME=/home/user
15 5-10 * * 1 5 /usr/bin/date > ${HOME}/log

(back to top)

- Translate to Spanish.

(back to top)

linux, command_line_intro, command_line, bash
OpenBSD manpages: crontab(1), crontab(5)

(back to top)

2026-03-27 : Created.

(back to top)

ohazot | about | ohazot.com <admin@ohazot.com>

This document applies to: OpenBSD 7.8 , linux | 2026-03-27