unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Unstable Horse <stable.master@unstable.horse>
To: James Thomas <jimjoe@gmx.net>, help-guix@gnu.org
Subject: Re: How to run a script on system shutdown/reboot
Date: Sat, 01 Jul 2023 12:09:29 +0200	[thread overview]
Message-ID: <d5baa3f7e4f89bcc48b1615c6f3a2d9981a66e8d.camel@unstable.horse> (raw)
In-Reply-To: <87leg0kmr8.fsf@gmx.net>

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


      reply	other threads:[~2023-07-02 13:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d5baa3f7e4f89bcc48b1615c6f3a2d9981a66e8d.camel@unstable.horse \
    --to=stable.master@unstable.horse \
    --cc=help-guix@gnu.org \
    --cc=jimjoe@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).