On Tue Apr05'22 10:02:35PM, Barry wrote:
From: Barry <barry(a)barrys-emacs.org>
Date: Tue, 5 Apr 2022 22:02:35 +0100
To: olivares33561 <olivares33561(a)protonmail.com>, Community support for
Fedora users <users(a)lists.fedoraproject.org>
Reply-To: Community support for Fedora users <users(a)lists.fedoraproject.org>
Subject: Re: convert crontab jobs to systemd timers
> On 5 Apr 2022, at 21:19, olivares33561 via users
<users(a)lists.fedoraproject.org> wrote:
>
> Dear kind Fedora users,
>
> I have a crontab file that I use to play some files about 3 minutes before bell
rings between classes. I had to install anacron with dnf command. I have seen emails
where some folks recommend systemd timers. How can I convert a crontab
> #
> [olivares@fedora Downloads]$ crontab -l
> # min hour day-of-month month day-of-week command
> # 0-59 0-23 1-31 1-12 0-6 0=sun 1=mon
> #50 04 * * 1-5 ~/.xalarm >/dev/null 2>&1
> #50 04 * * 0,6 ~/.salarm >/dev/null 2>&1
> #59 09 * * 0,6 ~/.salarm >/dev/null 2>&1
> #00 07 * * 1-5 ~/.xalarm >/dev/null 2>&1
> 42 08 * * 1-5 ~/.dalarm >/dev/null 2>&1
> 52 09 * * 1-5 ~/.dalarm >/dev/null 2>&1
> 40 10 * * 1-5 ~/.dalarm >/dev/null 2>&1
> 28 11 * * 1-5 ~/.dalarm >/dev/null 2>&1
> 16 12 * * 1-5 ~/.dalarm >/dev/null 2>&1
> 57 12 * * 1-5 ~/.dalarm >/dev/null 2>&1
> 40 14 * * 1-5 ~/.dalarm >/dev/null 2>&1
> 28 15 * * 1-5 ~/.dalarm >/dev/null 2>&1
> 17 16 * * 1-5 ~/.dalarm >/dev/null 2>&1
> #30 16 * * 1-5 ~/.lalarm > /dev/null 2>&1
> 25 16 * * 1-5 /usr/sbin/poweroff >/dev/null 2>&1
>
> #
> to systemd timers? An easy idiot proof way. The .dalarm script calls mplayer and
plays from a playlist.
>
> #
> [olivares@fedora Downloads]$ sudo systemctl list-timers
> [sudo] password for olivares:
> NEXT LEFT LAST PASSED UN>
> Tue 2022-04-05 15:13:39 CDT 1min 46s left n/a n/a sy>
> Tue 2022-04-05 15:38:11 CDT 26min left n/a n/a dn>
> Wed 2022-04-06 00:00:00 CDT 8h left Tue 2022-04-05 05:34:07 CDT 9h ago lo>
> Wed 2022-04-06 00:00:00 CDT 8h left Tue 2022-04-05 05:34:07 CDT 9h ago un>
> Wed 2022-04-06 00:34:55 CDT 9h left Tue 2022-04-05 05:34:07 CDT 9h ago pl>
> Sun 2022-04-10 01:00:00 CDT 4 days left Tue 2022-04-05 05:34:07 CDT 9h ago ra>
> Mon 2022-04-11 00:20:16 CDT 5 days left Tue 2022-04-05 05:34:07 CDT 9h ago fs>
>
> 7 timers listed.
> Pass --all to see loaded but inactive timers, too.
> #
>
> I have read
https://opensource.com/article/20/7/systemd-timers
> and
>
https://www.maketecheasier.com/use-systemd-timers-as-cron-replacement/
>
> but have not tried it out. Any help on this is appreciated. I want to test it out.
Thank you in advance
Why not try it out? What is stopping you?
The only thing I would add to you reading list if the man page for systemd.timer
I would start with a timer service that uses /bin/echo that you can use to see that the
timer service runs when you expect.
Barry
So sorry to suddenly wake up on this thread, but is cron going away. I use it all the
time, hourly for backups and nightly for updates.
Many thanks,
Ranjan