* How to run a script on system shutdown/reboot
@ 2023-06-21 12:16 Unstable Horse via
2023-07-01 9:24 ` James Thomas
0 siblings, 1 reply; 3+ messages in thread
From: Unstable Horse via @ 2023-06-21 12:16 UTC (permalink / raw)
To: help-guix
Good day, people. I am browsing the shepherd's info docs, and I can't
seem to find a way to run something right after either reboot, or halt
were invoked.
Something that is usually achieved by sticking a script into /etc/rc0.d
in classical init systems, or /usr/lib/systemd/system-shutdown in
systemd.
Can I somehow configure this from my system-wide config.scm? Or any way
at all, if that's not an option?
My particular use-case is unloading a faulty kernel module, that
prevents powering off the laptop right before shepherd actually tries
to shut it down.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to run a script on system shutdown/reboot
2023-06-21 12:16 How to run a script on system shutdown/reboot Unstable Horse via
@ 2023-07-01 9:24 ` James Thomas
2023-07-01 10:09 ` Unstable Horse
0 siblings, 1 reply; 3+ messages in thread
From: James Thomas @ 2023-07-01 9:24 UTC (permalink / raw)
To: Unstable Horse via; +Cc: Unstable Horse
Unstable Horse via wrote:
> Good day, people. I am browsing the shepherd's info docs, and I can't
> seem to find a way to run something right after either reboot, or halt
> were invoked.
>
> Something that is usually achieved by sticking a script into /etc/rc0.d
> in classical init systems, or /usr/lib/systemd/system-shutdown in
> systemd.
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.
--
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to run a script on system shutdown/reboot
2023-07-01 9:24 ` James Thomas
@ 2023-07-01 10:09 ` Unstable Horse
0 siblings, 0 replies; 3+ messages in thread
From: Unstable Horse @ 2023-07-01 10:09 UTC (permalink / raw)
To: James Thomas, help-guix
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-02 13:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-21 12:16 How to run a script on system shutdown/reboot Unstable Horse via
2023-07-01 9:24 ` James Thomas
2023-07-01 10:09 ` Unstable Horse
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.