[Nut-upsdev] RFC: nut and systemd

Arnaud Quette aquette.dev at gmail.com
Thu May 26 22:30:32 UTC 2011


Hi Michal,

2011/5/18 Michal Hlavinka <mhlavink at redhat.com>

> On Thursday, May 12, 2011 16:00:14 Michal Hlavinka wrote:
> > On Thursday, May 12, 2011 09:26:38 Arnaud Quette wrote:
> > > Hi Michal,
> > >
> > > first, I know understand where our "disagreement" comes from:
> > > in Debian, we have a generic ups-monitor role provided by several
> > > packages. the shutoff (final ups poweroff) hook is located in the
> > > package's initscript, and is called from halt.
> > > whereas, in RH/Fedora, you don't have this generic role (afaik), nor
> the
> > > hook in the package's initscript.
> >
> > in Fedora 14 (and older) the hook is in /etc/init.d/halt initscript. This
> no
> > longer exists in Fedora 15+. I've asked systemd maintainer if they ported
> > this hook from old initscript to systemd, because I was not able to find
> > it.
>
> they did not ported it to systemd, but we don't need them :)
>
> > > which means that NUT initscript in RH only has to deal with
> > > start/stop/restart, which are the standard conditions.
> > > I'll have to think more about that, but for the time being, you may
> want
> > > to progress with your previously mentioned approach (4).
> >
> > I'm already working on it. I'll send it to the list, when it's ready, but
> > just right now it's blocked by bug in systemd.
>
> sketch version attached (files in root source directory, paths hardcoded
> and so
> on... it's just a sketch version)
>

already interesting :)

btw:

- prefer to use 'nut' instead of 'ups' in .service names
nut-drivers, nut-server (probably better than 'nut-daemon') and nut-monitor

- also, prefer to mention 'devices' or better 'power devices', instead of
'UPS'


I've tested it on my system, but just once, seems my apc ups is deffective,
> because it reports error code with uninteruptable beep (it fails its own
> battery test when battery is (almost) empty - after AC reconnected). This
> is
> new ups with new battery, so I'll retest it, but most probably I'll need to
> send it back to apc. Anyway, sw part was working fine.
>

if you need a unit, you still have my offer (Eaton), iirc...

upsmon nor upsd does not support "foreground mode", which is preffered
> (see http://0pointer.de/public/systemd-man/daemon.html ) but it's not that
> big
> deal.
>

use '-D' ?!


> eh... seems I've forgot other comments... I'll have to write them down next
> time :)
>
> ...
> ...
>
> > > As an obvious (and probably the most basic) example with NUT:
> > > how will you handle the "poweroff" target of the NUT sysV init script?
> > >
> > >       if upsmon -K >/dev/null 2>&1 ; then
> > >
> > >         if upsdrvctl shutdown ; then
>
> just do:
>
> printf "#!/bin/sh\n upsmon -K >/dev/null 2>&1 && upsdrvctl shutdown" >
> /lib/systemd/system-shutdown/upsshutdown
>
> and prepare for systemd's almighty grumbling :D There was some futile
> "discussion" about how wrong is this, but there is no other way doing this
>

I'm interested in these "futile" discussions ;)

and how the 'upsshutdown' script actually called?
with systemd's limited possibilities, the only thing I see is the creation
of another .service file that Exec it on Stop, and that is executed at the
very end of the system shutdown?

cheers,
Arnaud
-- 
Linux / Unix Expert R&D - Eaton - http://powerquality.eaton.com
Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/
Debian Developer - http://www.debian.org
Free Software Developer - http://arnaud.quette.free.fr/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20110527/56be3244/attachment.html>


More information about the Nut-upsdev mailing list