Hi all, This is crazy but I can't see the answer.? In my system crontab I've added a job to stop the music system at 10:59 on the 11th November, and restart it at 11:02 on the 11th November # m??? h??? dom??? mon? dow??? user??? command ? 59? 10???? *???? 11??? *???? root???? /bin/squeezy -all -off >>/var/log/newplaylist 2>&1 ? 02? 11???? *???? 11??? *???? root???? /root/bin/newplaylist >/var/log/newplaylist 2>&1 However, it's doing this every day.? Can anyone see what's wrong?
Hello Gary, On Wed, 17 Nov 2021 11:15:52 +0000 Gary Stainburn <gary.stainburn at ringways.co.uk> wrote:> Hi all, > > This is crazy but I can't see the answer.? In my system crontab I've added a job to stop the music system at 10:59 on the 11th November, and restart it at 11:02 on the 11th November > > # m??? h??? dom??? mon? dow??? user??? command > ? 59? 10???? *???? 11??? *???? root???? /bin/squeezy -all -off >>/var/log/newplaylist 2>&1 > ? 02? 11???? *???? 11??? *???? root???? /root/bin/newplaylist >/var/log/newplaylist 2>&1 > > However, it's doing this every day.? Can anyone see what's wrong?> # m??? h??? dom??? mon? dow??? user??? command > ? 59? 10???? *? 11 ..^ This * makes it run for all days of the 11th month. Should you use, instead: ? 59? 10????11? 11 .. Regards, -- wwp https://useplaintext.email/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: OpenPGP digital signature URL: <http://lists.centos.org/pipermail/centos/attachments/20211117/1282d3c4/attachment-0005.sig>
Hello Gary, Am 2021-11-17 12:15, schrieb Gary Stainburn:> Hi all, > > This is crazy but I can't see the answer.? In my system crontab I've > added a job to stop the music system at 10:59 on the 11th November, and > restart it at 11:02 on the 11th November > > # m??? h??? dom??? mon? dow??? user??? command > ? 59? 10???? *???? 11??? *???? root???? /bin/squeezy -all -off > >>/var/log/newplaylist 2>&1 > ? 02? 11???? *???? 11??? *???? root???? /root/bin/newplaylist > >/var/log/newplaylist 2>&1 > > However, it's doing this every day.? Can anyone see what's wrong?I was recently struggling with reading crontab myself and found this useful page that I have no affiliation with -> https://crontab.guru/ It points out that the day of the month is set to '*', which means every day. If you want tasks to be executed one time only, look into `at` instead. Kind regards, Steve
On 11/17/21 12:15, Gary Stainburn wrote:> Hi all, > > This is crazy but I can't see the answer.? In my system crontab I've > added a job to stop the music system at 10:59 on the 11th November, > and restart it at 11:02 on the 11th November > > # m??? h??? dom??? mon? dow??? user??? command > ? 59? 10???? *???? 11??? *???? root???? /bin/squeezy -all -off > >>/var/log/newplaylist 2>&1 > ? 02? 11???? *???? 11??? *???? root???? /root/bin/newplaylist > >/var/log/newplaylist 2>&1 > > However, it's doing this every day.? Can anyone see what's wrong? >Instead of crontabs, maybe check systemd timers. https://fedoramagazine.org/systemd-timers-for-scheduling-tasks/ (CentOS - at least upto 7 - doesnt support user units, admin-managed system units are in /etc/systemd/system). I personally prefer systemd timers over crontabs. - Thomas