[Nut-upsuser] NUT on openSUSE 12.3 requires additional systemd service unit

Roger Price roger at rogerprice.org
Thu Aug 15 20:02:50 UTC 2013

On Wed, 14 Aug 2013, Michal Hlavinka wrote:

>> The service unit consists of a new file
>> /etc/systemd/system/ups-delayed-shutdown.service
> What exactly is this supposed to do?

The proposed service unit fixes an openSUSE 12.3 problem, in which the UPS 
is not powered off on system shutdown.

> When system is shutting down because of power failure (and low battery) 
> ups should be powered off with /lib/systemd/system-shutdown/nutshutdown 
> script.

In openSUSE 12.3 there is no directory /lib/systemd/system-shutdown, and 
no script "nutshutdown".  I am guessing that you use Fedora.

> That's also the correct location for ups shutdown script.

My original script was in /lib/systemd and I was told in the systemd-devel 
mailing list that home-brew scripts such as mine should not be placed 
there, but in /etc/systemd/system.

> It's executed after everything else. Using Before=umount.target is 
> especially bad bad idea. It's not guaranteed that umount sync can finish 
> in time,

Perhaps I misunderstand your comment, but I'm not worried about 
umount.target running late.  That's not a problem. Finishing early would 
be a problem, but that's what the "Before" and the "Type=oneshot" is 
intended to handle.

Quote from man systemd.service:	 Behavior of oneshot is similar to simple, 
however it is expected that the process has to exit before systemd starts 
follow-up units.

By the way, "Before=umount.target" didn't seem to shock the systemd 

> so you can have power down during filesystem sync with all the 
> consequences.

Agreed - systemd executes my openSUSE ups-delayed-shutdown.service at the 
very beginning of the shutdown sequence, and there is a very real 
possibility of the UPS shutdown with its default 20 sec delay occuring 
before the system shutdown.  That is why I have the options

   offdelay = 30
   ondelay = 40

in file /etc/ups/ups.conf.


More information about the Nut-upsuser mailing list