The timer installed by plocate insists on running updatedb at maximally inconvenient times. I looked at the docs for systemd timers and my brain screamed at me: "I don't feel like thinking hard enough to get this right!"
Anyone have an example of a systemd timer that runs at a specific time of day (like 1AM) so I can avoid thinking too hard? :-).
Can I override an installed systemd timer by putting a replacement with the same name under /etc somewhere?
On Tue, Jul 19, 2022 at 8:05 AM Tom Horsley horsley1953@gmail.com wrote:
Anyone have an example of a systemd timer that runs at a specific time of day (like 1AM) so I can avoid thinking too hard? :-).
I have the following in a timer to run a prune of my backup at 6 AM Mondays:
OnCalendar=Mon *-*-* 06:00:00
So if you wanted to have a timer run daily at 1am, you could use
OnCalendar=* *-*-* 01:00:00
(If you're fine with it running at midnight, you can use OnCalendar=daily)
A more detailed discussion is at https://www.freedesktop.org/software/systemd/man/systemd.time.html#Calendar%...
Can I override an installed systemd timer by putting a replacement with the same name under /etc somewhere?
Admin-installed units go in /etc/systemd/system . I believe anything you define there will override what ships in /usr/lib/systemd although I haven't verified that myself.
On Tue, 19 Jul 2022 08:48:12 -0400 Ben Cotton wrote:
(If you're fine with it running at midnight, you can use OnCalendar=daily)
So maybe if I just changed the "RandomizedDelaySec=12h" in the existing unit to something like "RandomizedDelaySec=2h" it would run some time between midnight and 2AM, which would probably be good enough to keep it out of my way.
On Tue, 19 Jul 2022 09:04:18 -0400 Tom Horsley horsley1953@gmail.com wrote:
On Tue, 19 Jul 2022 08:48:12 -0400 Ben Cotton wrote:
(If you're fine with it running at midnight, you can use OnCalendar=daily)
So maybe if I just changed the "RandomizedDelaySec=12h" in the existing unit to something like "RandomizedDelaySec=2h" it would run some time between midnight and 2AM, which would probably be good enough to keep it out of my way.
I had a similar issue, except that it was running immediately after boot, performing lots of disk io when I wanted to do other things. I changed the updatedb.timer file by adding OnBootSec=3h and changed the AccuracySec=1h instead of the 24 hours it had originally. That starts updatedb sometime between 2 and 4 hours after boot. I don't know the internals of systemd, but I assume that the accuracy means it only checks that often.
And now it doesn't run immediately after boot.