There is a record:
45 * * * 1 script.sh
and
45 0-23 * * 1 script.sh
The desired effect is to run the script 45 minutes after every hour on Mondays.
Are they identical? If not, what is the difference?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityThere is a record:
45 * * * 1 script.sh
and
45 0-23 * * 1 script.sh
The desired effect is to run the script 45 minutes after every hour on Mondays.
Are they identical? If not, what is the difference?
They both work. However, I would personally prefer:
45 * * * mon script.sh
As it is more readable, and more immediately understandable without having to remember which day of the week is '1'.
mon
as a day name is a GNU extension to standard crontab
. It's not likely available on non-GNU systems.
Jul 18, 2017 at 11:13