[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to run a script on system shutdown/reboot
From: |
Unstable Horse |
Subject: |
Re: How to run a script on system shutdown/reboot |
Date: |
Sat, 01 Jul 2023 12:09:29 +0200 |
User-agent: |
Evolution 3.48.3 (by Flathub.org) |
On Sat, 2023-07-01 at 14:54 +0530, James Thomas wrote:
> What I'd gleaned when I looked into this a while ago:
>
> These functions are in elogind, whose hook directories are:
>
> (PKGSYSCONFDIR = PREFIX/etc/elogind)/system-shutdown
> (rootlibexecdir = (rootprefixdir = PREFIX)/lib/elogind)/system-
> shutdown
>
> As of then both these directories pointed to the store build. I
> remember trying to figure out whether to patch the package definition
> or elogind itself, before I moved on to other things.
Thanks for the reply, I ended up solving my particular problem by
spinning up a python script shepherd service that monitors elogind for
shutdown and sleep events via D-Bus.
I've seen other people solve the same problem by creating a dummy
"sleep infinity" shepherd service, and then adding the code they want
to run on shutdown in the service's destructor (but this doesn't handle
sleep). Like this:
https://gitlab.com/nonguix/nonguix/-/issues/205#note_1253482556