top | item 43099453

(no title)

mafuyu | 1 year ago

I just did `ExecStart` with `multi-user.target`. That implies the unit is `simple`, so it very well could be sequencing incorrectly at boot and failing. That's a good point; I'll have to keep that in mind!

discuss

order

jorvi|1 year ago

Apologies for the confusion, I don't mean it was failing to run.

If you don't add "RemainAfterExit", the service will run at every boot, because after a reboot it is considered "inactive. This will execute your shell code, which effectively toggles wakeup.

"RemainAfterExit" is meant for unit files that change the state of your system. After running once, the service will be considered "active", until you manually deactivate it, which will execute whatever you might have set in "ExecStop".

"Type=Oneshot" is necessary for "RemainAfterExit".

In this case I still would prefer doing it via udev though. I've made it my rule of thumb to evade shell scripting wherever feasible, because it usually ends up being more brittle, and more prone to footgunning :)

mafuyu|1 year ago

Ahh, gotcha, thanks for the tip. Yeah, systemd is easy to reach for, but it certainly has plenty of footguns.