Subject: Problem with crontab

From: Wolfgang Klein <[email-masked]>
Date: Sat, 30 Aug 2025 20:58:05 +0200

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

---

From: Andreas Kähäri <[email-masked]>
Date: Sat, 30 Aug 2025 21:29:46 +0200

On Sat, Aug 30, 2025 at 08:58:05PM +0200, Wolfgang Klein wrote:
> hours. That's why there are two lines: one that's to be executed Monday to
> Friday, and one on Saturday and Sunday.
> 
> 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?
> 

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

.

---

From: Wolfgang Klein <[email-masked]>
Date: Sat, 30 Aug 2025 22:09:33 +0200

Here's a big THANK YOU, Andreas! :)

Cheers,
Wolfgang

---

From: Prabu Anand Kalivaradhan <[email-masked]>
Date: Sun, 31 Aug 2025 08:46:13 +0530

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 <[email-masked]> wrote:

> DOW