summaryrefslogtreecommitdiffhomepage
path: root/blog/entry/systemdtimerpersistent.mdwn
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2018-12-22 17:00:58 +0000
committerSean Whitton <spwhitton@spwhitton.name>2018-12-22 17:00:58 +0000
commitc3508a2f38ffcd6a6fe700bc90b29543ccfdfb90 (patch)
treedc85dd2557a3448dfed40888058fc741648ed502 /blog/entry/systemdtimerpersistent.mdwn
parent1e3ba29fbd0fc050d4a93beeeb5a10403c11d2af (diff)
downloadwiki-c3508a2f38ffcd6a6fe700bc90b29543ccfdfb90.tar.gz
new blog entry
Diffstat (limited to 'blog/entry/systemdtimerpersistent.mdwn')
-rw-r--r--blog/entry/systemdtimerpersistent.mdwn36
1 files changed, 36 insertions, 0 deletions
diff --git a/blog/entry/systemdtimerpersistent.mdwn b/blog/entry/systemdtimerpersistent.mdwn
new file mode 100644
index 0000000..f53be1e
--- /dev/null
+++ b/blog/entry/systemdtimerpersistent.mdwn
@@ -0,0 +1,36 @@
+[[!meta title="Persistent=true when the timer never triggers when the system is powered up"]]
+[[!tag gnu+linux systemd]]
+
+I have this systemd timer unit
+
+[[!format ini """
+[Unit]
+Description=Run i3-rotate-wallpaper daily
+
+[Timer]
+OnCalendar=daily
+Persistent=true
+
+[Install]
+WantedBy=timers.target
+]]
+
+which says to start the i3-rotate-wallpaper.service unit at each
+midnight.
+
+`Persistent=true` is meant to ensure that the unit is triggered
+immediately when the system resumes from suspend or is powered on, if
+at the most recent midnight it was suspended or powered off. The idea
+is that when I first use my computer each day, the wallpaper gets
+changed -- I delight in seeing the wallpapers I've downloaded.
+
+The problem is that `Persistent=true` only works if the timer has been
+triggered at least once when the system is not suspended and powered
+on. But my computer is almost never on at midnight. I don't want to
+have to leave it turned on just for the first wallpaper change, or
+keep track of that when reinstalling the machine's operating system.
+
+The fix:
+
+ % mkdir -p "$HOME/.local/share/systemd/timers"
+ % touch "$HOME/.local/share/systemd/timers/stamp-i3-rotate-wallpaper.timer"