From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id sFcyFsiAoWRHXgEASxT56A (envelope-from ) for ; Sun, 02 Jul 2023 15:51:04 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id WNxHFciAoWQZigAAG6o9tA (envelope-from ) for ; Sun, 02 Jul 2023 15:51:04 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 23F2E3FDEA for ; Sun, 2 Jul 2023 15:51:04 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFxTO-0000Ki-9g; Sun, 02 Jul 2023 09:50:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qFXXx-0004fn-Ef for help-guix@gnu.org; Sat, 01 Jul 2023 06:09:41 -0400 Received: from [140.82.58.198] (helo=unstable.horse) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qFXXv-0007Go-9D for help-guix@gnu.org; Sat, 01 Jul 2023 06:09:41 -0400 Received: from unstable.horse (localhost [127.0.0.1]) by unstable.horse (OpenSMTPD) with ESMTP id 59e61b26; Sat, 1 Jul 2023 10:09:35 +0000 (UTC) Received: from [192.168.1.9] ([93.87.150.145]) by unstable.horse with ESMTPSA id 8lZPB1/7n2SNIwEA+/WzFw (envelope-from ); Sat, 01 Jul 2023 10:09:35 +0000 Message-ID: Subject: Re: How to run a script on system shutdown/reboot From: Unstable Horse To: James Thomas , help-guix@gnu.org Date: Sat, 01 Jul 2023 12:09:29 +0200 In-Reply-To: <87leg0kmr8.fsf@gmx.net> References: <0dde05f2e018ed6c1ca6fbfc31bbcb53458c9460.camel@unstable.horse> <87leg0kmr8.fsf@gmx.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.3 (by Flathub.org) MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 140.82.58.198 (failed) Received-SPF: pass client-ip=140.82.58.198; envelope-from=stable.master@unstable.horse; helo=unstable.horse X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 02 Jul 2023 09:50:40 -0400 X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: help-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1688305864; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=baZZYT2EEkXPjLynaWKHyXPg5XDGDhaOHyUbFpUh2SU=; b=W84v8gWGQpokVXml+Eesu5nt0amIhjcThOaJy6IlVsEAV2ZZ2ohjXtp+0wFfgWsUVeH/6g qn6eiWD+78q4G704S1WUEt4HdVCC65TJd1eh0gBNun+RrcNZrjS/epaqMsJy8wAux1+kVf DF7IRvbEeWqXNxbvsFdutomejM8aFOg7sYmEKoOohydBWUy33Wh7ize4ba9YPl9JX3INlY OVU166DoosvV+tSISXCgsnRjSEavc7DYcYC9OlN8KRjUTPK/vIpp03QP98epKv7xtWweVd ng1jV0vVI5J3uehCPQqsZSdg89b6LEVkiP9VzLP+8nK+ixN5GgHBdQBaJ/K79g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=unstable.horse (policy=none); spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1688305864; a=rsa-sha256; cv=none; b=DpotZ6bWOesXuFwRBbys37ojqwZTRA94NEObMC5W7CsxKM8KTXtj7MsR78rq6ITYqMnq3s XHrjDs0fZUzm8A7xNdh4SNLXw9xVzqe/zcfJFdAi9BBGEk+inwxValZmu+/ns4s+8in6qg B+7DKgz2L+Y5AUhZ4hBHiX5GDLByLtn/XrYqjEgFUeAIesOrMf+edzXvt7f7kzlfHdkiE/ LJs5wu3oONpe5T/9NL5vhTQZDGUse2MdLZ9K8aJRe0XPinCaVyuZ3EBlcJbGNFNirD0RGI 2+KaI7ipndGKlhR9nBSgp+VTjTC5yW3TPKNgX1y1mZjvfjbM+oZCm/gJSWio/w== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -0.45 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=unstable.horse (policy=none); spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 23F2E3FDEA X-Spam-Score: -0.45 X-TUID: G696vHoKRkVH On Sat, 2023-07-01 at 14:54 +0530, James Thomas wrote: > What I'd gleaned when I looked into this a while ago: >=20 > These functions are in elogind, whose hook directories are: >=20 > (PKGSYSCONFDIR =3D PREFIX/etc/elogind)/system-shutdown > (rootlibexecdir =3D (rootprefixdir =3D PREFIX)/lib/elogind)/system- > shutdown >=20 > 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