systemd questions

Lennart Poettering mzerqung at 0pointer.de
Tue May 17 14:16:30 UTC 2011


On Tue, 17.05.11 15:42, Michal Hlavinka (mhlavink at redhat.com) wrote:

> 
> > > 5) in old initscripts, there was /etc/init.d/halt with section for ups
> > > shutdown. With that script gone, was that functionality ported to
> > > systemd
> > > somehow?
> > 
> > Well, any such code is just inherently broken. It *cannot* work. A
> > number of kernel subsystems hook into the shutdown code of the
> > kernel. For example storage code syncs meta data to disk after the
> > reboot() syscall is invoked. If you however turn off power before
> > reaching reboot(), then this step is omitted which might trigger data
> > loss. UPS code like that needs to sit in the kernel itself to properly
> > work. Adding userspace kludges which invokes this from userspace is a
> > recipe for desaster. The point of UPS is to prevent data loss after all,
> > and if you turn off the power before the kernel dealt with reboot() you
> > invite data loss. (And no, just adding random sleeps, is not a fix, it
> > just delays the problem.)
> > 
> > (That all said you may drop binaries into /lib/systemd/system-shutdown
> > which are executed right before invoking reboot(). But if you package
> > anything that drops binaries into that dir 
> ...
> 
> how can automake & friends use this directory?
> 
> FOO=$(pkg-config --variable=systemdsystemunitdir systemd)/../system-shutdown
> (or FOO=$(dirname $(pkg-config --variable=systemdsystemunitdir systemd) 
> )/system-shutdown
>  or is there a better way for this?

I'd probably hardcode /lib/systemd/system-shutdown/. It cannot really be
placed anywhere else, otherwise it loses its usefulness.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the devel mailing list