[Nut-upsdev] RFC: nut and systemd
Michal Hlavinka
mhlavink at redhat.com
Wed May 18 07:38:21 UTC 2011
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)
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.
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.
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nut-systemd.patch
Type: text/x-patch
Size: 5627 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20110518/b1d37569/attachment.bin>
More information about the Nut-upsdev
mailing list