Hello,
in my crontab there are these two entries:
7,37 0-7,18-23 * * 1-5 command
7,37 * * * 6,7 command
"Command" needs to be executed every 30 minutes, *except* during office
hours. That's why there are two lines: one that's to be executed Monday
to Friday, and one on Saturday and Sunday.
On Ubuntu, this has been working perfectly as expected for years now. On
Alpine, the DOW field seems to be ignored somehow: "command" is executed
every 30 minutes on each day of the week! It seems that the second call
is executed regardless of the DOW entry.
Does cron on Alpine need a different syntax? Does it not know about the
DOW option?
Thanks in advance for any help!
Regards,
Wolfgang
On Sat, Aug 30, 2025 at 08:58:05PM +0200, Wolfgang Klein wrote:
> Hello,> > in my crontab there are these two entries:> > > 7,37 0-7,18-23 * * 1-5 command> 7,37 * * * 6,7 command> > > "Command" needs to be executed every 30 minutes, *except* during office> hours. That's why there are two lines: one that's to be executed Monday to> Friday, and one on Saturday and Sunday.> > On Ubuntu, this has been working perfectly as expected for years now. On> Alpine, the DOW field seems to be ignored somehow: "command" is executed> every 30 minutes on each day of the week! It seems that the second call is> executed regardless of the DOW entry.> > Does cron on Alpine need a different syntax? Does it not know about the DOW> option?> > Thanks in advance for any help!> > > Regards,> > Wolfgang> >
The busybox cron does not understand "7" as a valid day of the
week. The Vixie cron daemon allows for using either "0" or "7"
as Sunday, but busybox cron only allows "0" for Sunday (as per
POSIX).
So you need to change your second line to:
7,37 * * * 6,0 command
I ran into this myself a while ago and decided to look deeper into the
busybox cron source code to confirm this.
See my issue and resolution here:
https://unix.stackexchange.com/questions/783517
--
Matti Andreas Kähäri (Kusalananda)
Uppsala, Sweden
.
Thanks for the note, Andreas. wiki <https://wiki.alpinelinux.org/wiki/Cron>
updated.
On Sun, 31 Aug 2025 at 01:00, Andreas Kähäri <andreas.kahari@abc.se> wrote:
> On Sat, Aug 30, 2025 at 08:58:05PM +0200, Wolfgang Klein wrote:> > Hello,> >> > in my crontab there are these two entries:> >> >> > 7,37 0-7,18-23 * * 1-5 command> > 7,37 * * * 6,7 command> >> >> > "Command" needs to be executed every 30 minutes, *except* during office> > hours. That's why there are two lines: one that's to be executed Monday> to> > Friday, and one on Saturday and Sunday.> >> > On Ubuntu, this has been working perfectly as expected for years now. On> > Alpine, the DOW field seems to be ignored somehow: "command" is executed> > every 30 minutes on each day of the week! It seems that the second call> is> > executed regardless of the DOW entry.> >> > Does cron on Alpine need a different syntax? Does it not know about the> DOW> > option?> >> > Thanks in advance for any help!> >> >> > Regards,> >> > Wolfgang> >> >>> The busybox cron does not understand "7" as a valid day of the> week. The Vixie cron daemon allows for using either "0" or "7"> as Sunday, but busybox cron only allows "0" for Sunday (as per> POSIX).>> So you need to change your second line to:>> 7,37 * * * 6,0 command>> I ran into this myself a while ago and decided to look deeper into the> busybox cron source code to confirm this.>> See my issue and resolution here:>> https://unix.stackexchange.com/questions/783517>> --> Matti Andreas Kähäri (Kusalananda)> Uppsala, Sweden>> .>