Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: OT:Any (Linux) UPS experts ?

30 views
Skip to first unread message
Message has been deleted

Dave Liquorice

unread,
May 24, 2013, 6:03:04 AM5/24/13
to
On Fri, 24 May 2013 09:41:38 GMT, Jethro_uk wrote:

> It's this last step that I can't make happen. I'm using the upssched
> module, and have put "/sbin/shutdown -h 0" in upssched.sh, but it's
> just being ignored.

Does that work from the comamnd line? The man page for shutdown on my
linux box would have a + before the 0 or use "now".

> In the NUT docs, it does seem to hint that the NUT system won't
> actually go to shutdown till the UPS sends a "battery low" signal.

That's the default configuration, you can have any of the signalled
events trigger a shutdown. Mine starts the moment the power goes (ONBATT)
as the UPS also has to keep other, far more important, things up. I can't
remember the exact way to change it, it might just be a case of moving
the shutdown bit in upsshed.conf from one signal to another.

--
Cheers
Dave.



Tim Watts

unread,
May 24, 2013, 6:18:54 AM5/24/13
to
On Friday 24 May 2013 10:41 Jethro_uk wrote in uk.d-i-y:

> Stuck at the last stage of setting up my server, and that is getting the
> (Eaton NV400) UPS configured.
>
> Server is running Debian Wheezy. I have installed and configured NUT, and
> so far everything works. It connects to the USB port, reads the UPS, and
> reacts to a power off event.
>
> However, in my config, I want the following:
>
> Power cut: - send SMS, start 10 minute timer
> 10 minutes elapse:- shut down UPS (it has a 30 second grace period,
> allowing computer to shutdown); then:
> Shutdown PC.
>
> It's this last step that I can't make happen. I'm using the upssched
> module, and have put "/sbin/shutdown -h 0" in upssched.sh, but it's just
> being ignored. Tried googling, but nothing jumped out.

Is nut running as root (ps axu) ? shutdown cannot run as non root by
default. If I'm right then you need some /etc/sudoers magic to allow nut to
run shutdown with no password.

> In the NUT docs, it does seem to hint that the NUT system won't actually
> go to shutdown till the UPS sends a "battery low" signal. If this is the
> case, then I can live with it. However I don't really like the idea of
> pulling the plug and running down the battery to find out.
>
> All this is to avoid what happened when I *didn't* have any UPS software
> configured. We had a longish outage - the PC didn't shutdown, and the UPS
> battery doubled in size. I was lucky to be able to replace it.
--
Tim Watts Personal Blog: http://squiddy.blog.dionic.net/

http://www.sensorly.com/ Crowd mapping of 2G/3G/4G mobile signal coverage

Reading this on the web? See:
http://wiki.diyfaq.org.uk/index.php?title=Usenet

Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

The Natural Philosopher

unread,
May 24, 2013, 8:20:58 AM5/24/13
to
On 24/05/13 11:03, Dave Liquorice wrote:
> On Fri, 24 May 2013 09:41:38 GMT, Jethro_uk wrote:
>
>> It's this last step that I can't make happen. I'm using the upssched
>> module, and have put "/sbin/shutdown -h 0" in upssched.sh, but it's
>> just being ignored.
> Does that work from the comamnd line? The man page for shutdown on my
> linux box would have a + before the 0 or use "now".
If in doubt sync; sync; halt; effectively pulls the plug on the linux.

>> In the NUT docs, it does seem to hint that the NUT system won't
>> actually go to shutdown till the UPS sends a "battery low" signal.
> That's the default configuration, you can have any of the signalled
> events trigger a shutdown. Mine starts the moment the power goes (ONBATT)
> as the UPS also has to keep other, far more important, things up. I can't
> remember the exact way to change it, it might just be a case of moving
> the shutdown bit in upsshed.conf from one signal to another.
>


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.

The Natural Philosopher

unread,
May 24, 2013, 8:22:11 AM5/24/13
to
On 24/05/13 12:09, Jethro_uk wrote:
> On Fri, 24 May 2013 11:18:54 +0100, Tim Watts wrote:
>
>> On Friday 24 May 2013 10:41 Jethro_uk wrote in uk.d-i-y:
>>
>>> Stuck at the last stage of setting up my server, and that is getting
>>> the (Eaton NV400) UPS configured.
>>>
>>> Server is running Debian Wheezy. I have installed and configured NUT,
>>> and so far everything works. It connects to the USB port, reads the
>>> UPS, and reacts to a power off event.
>>>
>>> However, in my config, I want the following:
>>>
>>> Power cut: - send SMS, start 10 minute timer 10 minutes elapse:- shut
>>> down UPS (it has a 30 second grace period, allowing computer to
>>> shutdown); then:
>>> Shutdown PC.
>>>
>>> It's this last step that I can't make happen. I'm using the upssched
>>> module, and have put "/sbin/shutdown -h 0" in upssched.sh, but it's
>>> just being ignored. Tried googling, but nothing jumped out.
>> Is nut running as root (ps axu) ? shutdown cannot run as non root by
>> default. If I'm right then you need some /etc/sudoers magic to allow nut
>> to run shutdown with no password.
>>
> to be fair NUT is very paranoid about security. Digging further, I see
> that non-root users can be allowed to use shutdown if they are in /etc/
> shutdown.allow and you pass the username to shutdown. I'll try that.
>
> My Unix is rusty, but wasn't there a way to run a process as another
> user, so you can test permissions and the like ?
yes, as root simply do
su - user

to become that user completely.

Clive George

unread,
May 24, 2013, 8:39:31 AM5/24/13
to
On 24/05/2013 13:12, Jethro_uk wrote:
> On Fri, 24 May 2013 11:25:22 +0000, Huge wrote:
>
>> On 2013-05-24, Jethro_uk <jeth...@hotmailbin.com> wrote:
>>
>>> My Unix is rusty, but wasn't there a way to run a process as another
>>> user, so you can test permissions and the like ?
>>
>> sudo
>
> problem is that requires a users password ... the nut user isn't an
> interactive one, so has no password ...

No it doesn't.


Tim Watts

unread,
May 24, 2013, 8:40:45 AM5/24/13
to
On Friday 24 May 2013 13:12 Jethro_uk wrote in uk.d-i-y:

> On Fri, 24 May 2013 11:25:22 +0000, Huge wrote:
>
>> On 2013-05-24, Jethro_uk <jeth...@hotmailbin.com> wrote:
>>
>>> My Unix is rusty, but wasn't there a way to run a process as another
>>> user, so you can test permissions and the like ?
>>
>> sudo
>
> problem is that requires a users password ... the nut user isn't an
> interactive one, so has no password ...

That's why /etc/sudoers has the NOPASSWD directive :)

Bob Eager

unread,
May 24, 2013, 8:46:12 AM5/24/13
to
On Fri, 24 May 2013 11:06:39 +0000, Jethro_uk wrote:

> On Fri, 24 May 2013 11:03:04 +0100, Dave Liquorice wrote:
>
>> On Fri, 24 May 2013 09:41:38 GMT, Jethro_uk wrote:
>>
>>> It's this last step that I can't make happen. I'm using the upssched
>>> module, and have put "/sbin/shutdown -h 0" in upssched.sh, but it's
>>> just being ignored.
>>
>> Does that work from the comamnd line? The man page for shutdown on my
>> linux box would have a + before the 0 or use "now".
>
> Sorry, me being sloppy. Ideally the command I would like to use is:
>
> /etc/init.d/nut-client poweroff
>
> however this returns:
>
> [info] Power down flag is not set (UPS poweroff not needed).

Then set it. It's merely an empty file, name specified in upsmon.conf.
Create it.

> even if I try it when on battery. So then I try:
>
> /sbin/shutdown now
>
> which is just being ignored. I put a log message before and after it in
> the upssched.sh script, and they are run.
>
>
>>> In the NUT docs, it does seem to hint that the NUT system won't
>>> actually go to shutdown till the UPS sends a "battery low" signal.

Or use: upsmon -c fsd

--
Use the BIG mirror service in the UK: http://www.mirrorservice.org
My posts (including this one) are my copyright and if @diy_forums on
Twitter wish to tweet them they can pay me £30 a post
*lightning surge protection* - a w_tom conductor
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Timothy Murphy

unread,
May 25, 2013, 9:08:52 AM5/25/13
to
Jethro_uk wrote:

> All this is to avoid what happened when I *didn't* have any UPS software
> configured. We had a longish outage - the PC didn't shutdown, and the UPS
> battery doubled in size. I was lucky to be able to replace it.

I would have thought the UPS would shut down anyway,
without any software configured, when its battery got low?

--
Timothy Murphy
e-mail: gayleard /at/ eircom.net
tel: +353-86-2336090, +353-1-2842366
s-mail: School of Mathematics, Trinity College Dublin

The Natural Philosopher

unread,
May 25, 2013, 11:08:04 AM5/25/13
to
On 25/05/13 14:08, Timothy Murphy wrote:
> Jethro_uk wrote:
>
>> All this is to avoid what happened when I *didn't* have any UPS software
>> configured. We had a longish outage - the PC didn't shutdown, and the UPS
>> battery doubled in size. I was lucky to be able to replace it.
> I would have thought the UPS would shut down anyway,
> without any software configured, when its battery got low?
>
I think he wants to keep the UPS/PC alive only long enough to achieve an
orderly shutdown.

Not to keep computing through the powercut...
Message has been deleted
Message has been deleted
0 new messages