crontab puzzlement
Colin Law
clanlaw at gmail.com
Mon Apr 3 20:22:49 UTC 2023
On Mon, 3 Apr 2023 at 21:11, David Fletcher <dave at thefletchers.net> wrote:
>
> Hi,
>
> I thought I understood how this works, but....
>
> Running a 22.04.2 LTS headless server
>
> The following two lines are added to /etc/crontab
> 0,20,40 7-10,16-19 25-30 4 1-5 dave play -qV0 fileA.flac
> 10,30,50 7-10,16-19 25-30 4 1-5 dave play -qV0 fileB.flac
>
> Path to file locations removed to fit on one line
>
> Each audio file is 8 minutes or so long and the two play in turn at the
> designated hours of the day. cron appears to obey the two hours of the
> day ranges that I have set, so it plays them 07:00-11:00 and 16:00-
> 20:00,
>
> BUT....
>
> I was expecting it to not start playing until Tuesday 25th April so why
> was it playing the sound files today? I thought it was OK to put in day
> of the month ranges same as hours of the day ranges, but, cron seems to
> behave here as if it's a * in the day of the month field.
Cron ORs together dom and dow, so if the dom is 25-30 OR dow is 1-5
then it will play.l
If you want just 25th to 30th then use * for dow
Colin
More information about the ubuntu-users
mailing list