[systemd-devel] [EXT] Re: scheduling services first during shutdown/reboot

Windl, Ulrich u.windl at ukr.de
Fri Feb 14 07:07:48 UTC 2025


I wonder: Can such a thing be expressed via an [install] section, too? Fumbling with the filesystem this way feels wrong to me, because when uninstalling such a unit, it will probably leave garbage behind (assuming that systemd collects garbage normally).
Or is the expectation that such garbage does not harm, and the operator is expected to do the cleanup instead?

Kind regards,
Ulrich Windl

> -----Original Message-----
> From: systemd-devel <systemd-devel-bounces at lists.freedesktop.org> On
> Behalf Of Andrei Borzenkov
> Sent: Wednesday, February 12, 2025 6:54 PM
> To: Olaf Hering <olaf at aepfle.de>; systemd-devel at lists.freedesktop.org
> Subject: [EXT] Re: [systemd-devel] scheduling services first during
> shutdown/reboot
> 
> 12.02.2025 16:35, Olaf Hering wrote:
> > What is the proper way to run a service as the very first unit when the
> > system goes down? I want to run it before systemd stops active sessions
> > with "Stopping Session N of User $user...".
> >
> > It seems that "After=session-N.scope" does have the desired effect,
> > but I may have to list every possible value of N, to not miss anything.
> >
> 
> mkdir -p /etc/systemd/system/session-.scope.d
> printf "[Unit]\nBefore=your-very-first.service\n" >
> /etc/systemd/system/session-.scope.d/before.conf
> 
> > There is nothing obvious mentioned in systemd.special.
> >
> >
> > Thanks,
> > Olaf



More information about the systemd-devel mailing list