Hi Michal,<br><br><div class="gmail_quote">2011/5/18 Michal Hlavinka <span dir="ltr"><<a href="mailto:mhlavink@redhat.com">mhlavink@redhat.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Thursday, May 12, 2011 16:00:14 Michal Hlavinka wrote:<br>
> On Thursday, May 12, 2011 09:26:38 Arnaud Quette wrote:<br>
> > Hi Michal,<br>
> ><br>
> > first, I know understand where our "disagreement" comes from:<br>
> > in Debian, we have a generic ups-monitor role provided by several<br>
> > packages. the shutoff (final ups poweroff) hook is located in the<br>
> > package's initscript, and is called from halt.<br>
> > whereas, in RH/Fedora, you don't have this generic role (afaik), nor the<br>
> > hook in the package's initscript.<br>
><br>
> in Fedora 14 (and older) the hook is in /etc/init.d/halt initscript. This no<br>
> longer exists in Fedora 15+. I've asked systemd maintainer if they ported<br>
> this hook from old initscript to systemd, because I was not able to find<br>
> it.<br>
<br>
</div>they did not ported it to systemd, but we don't need them :)<br>
<div class="im"><br>
> > which means that NUT initscript in RH only has to deal with<br>
> > start/stop/restart, which are the standard conditions.<br>
> > I'll have to think more about that, but for the time being, you may want<br>
> > to progress with your previously mentioned approach (4).<br>
><br>
> I'm already working on it. I'll send it to the list, when it's ready, but<br>
> just right now it's blocked by bug in systemd.<br>
<br>
</div>sketch version attached (files in root source directory, paths hardcoded and so<br>
on... it's just a sketch version)<br></blockquote><div> <br>already interesting :)<br><br>btw:<br><br>- prefer to use 'nut' instead of 'ups' in .service names<br>nut-drivers, nut-server (probably better than 'nut-daemon') and nut-monitor<br>
<br>- also, prefer to mention 'devices' or better 'power devices', instead of 'UPS'<br><br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

I've tested it on my system, but just once, seems my apc ups is deffective,<br>
because it reports error code with uninteruptable beep (it fails its own<br>
battery test when battery is (almost) empty - after AC reconnected). This is<br>
new ups with new battery, so I'll retest it, but most probably I'll need to<br>
send it back to apc. Anyway, sw part was working fine.<br></blockquote><div><br>if you need a unit, you still have my offer (Eaton), iirc...<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

upsmon nor upsd does not support "foreground mode", which is preffered<br>
(see <a href="http://0pointer.de/public/systemd-man/daemon.html" target="_blank">http://0pointer.de/public/systemd-man/daemon.html</a> ) but it's not that big<br>
deal.<br></blockquote><div><br>use '-D' ?!<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
eh... seems I've forgot other comments... I'll have to write them down next<br>
time :)<br>
<br>
...<br>
...<br>
<div class="im"><br>
> > As an obvious (and probably the most basic) example with NUT:<br>
> > how will you handle the "poweroff" target of the NUT sysV init script?<br>
> ><br>
> >       if upsmon -K >/dev/null 2>&1 ; then<br>
> ><br>
> >         if upsdrvctl shutdown ; then<br>
<br>
</div>just do:<br>
<br>
printf "#!/bin/sh\n upsmon -K >/dev/null 2>&1 && upsdrvctl shutdown" ><br>
/lib/systemd/system-shutdown/upsshutdown<br>
<br>
and prepare for systemd's almighty grumbling :D There was some futile<br>
"discussion" about how wrong is this, but there is no other way doing this<br></blockquote></div><br>I'm interested in these "futile" discussions ;)<br><br>and how the 'upsshutdown' script actually called?<br>
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?<br><br>cheers,<br>Arnaud<br>-- <br>
Linux / Unix Expert R&D - Eaton - <a href="http://powerquality.eaton.com" target="_blank">http://powerquality.eaton.com</a><br>Network UPS Tools (NUT) Project Leader - <a href="http://www.networkupstools.org/" target="_blank">http://www.networkupstools.org/</a><br>
Debian Developer - <a href="http://www.debian.org" target="_blank">http://www.debian.org</a><br>Free Software Developer - <a href="http://arnaud.quette.free.fr/" target="_blank">http://arnaud.quette.free.fr/</a><br><br>