On Sat, 10.08.13 17:02, Roger Price (ro...@rogerprice.org) wrote:

> I am new to systemd and I am trying to power off a UPS unit using a
> home-made service unit
> /lib/systemd/system/ups-delayed-shutdown.service running on openSUSE
> 12.3.

So, it's a really bad idea to turn off UPS from userspace, simply
because you will race against the kernel's fs sync() code, and you
never know what will finish first: your UPS shutdown timeout or your fs
sync(). Doing this from userspace is hence racy.

If you want to use a hack like this then at least do it via the
/usr/lib/systemd/system-shutdown/ drop-in directory which is called very
late during shutdown. It will shorten the race window, but not erase it,
since the kernel will flush various buffers only after the reboot()
system call is invoked.

See systemd-shutdown(8) for details.


Lennart Poettering - Red Hat, Inc.
systemd-devel mailing list

Reply via email to