lutz.niederer at gmx.net
2013-May-16 10:23 UTC
[Nut-upsuser] placement of ups shutdown command for snmp systems
Hi, ? on Debian and maybe other systems one of the last steps the system's shutdown procedure does is to shut down the UPS via upsdrvctl to turn off the machine and to conserve power.? But this is a place where network communications via SNMP is not possible anymore because the interfaces are down. ? So, I am looking for a good place where I can turn off the UPS.? In upsmon.conf there is the SHUTDOWNCMD.? Currently this is something like "/sbin/shutdown -h +0".? I thought I could change that to a shell script that sends the UPS a shutdown with delay command (90sec) and then immediately runs the "/sbin/shutdown -h +0" command. ? In the shutdown procedure that is initiated via shutdown -h +0 is there any point where the shutdown could be interrupted due to power coming back or is this the final command that always results in the machine being brought down?? I looked through the scripts that are involved and found nothing.? So my thoughts are that this is a safe place for the ups shutdown command. ? Thank for hints, tips, ideas and comments! ? -lutzn ? ?
lutz.niederer at gmx.net
2013-May-20 23:23 UTC
[Nut-upsuser] placement of ups shutdown command for snmp systems
>> In the shutdown procedure that is initiated via shutdown -h +0 is there any point where the shutdown could be interrupted due to power coming back or is this the final command that always results in the machine being brought down? I looked through the scripts that are involved and found nothing. So my thoughts are that this is a safe place for the ups shutdown command. > > I haven't looked at the shutdown procedure recently, but the most common way for an UPS to avoid a race condition when the power comes back is as follows: once the UPS receives the shutdown command from NUT, it will always cut power at the scheduled time, even if only momentarily. If line power has returned, momentarily interrupting the UPS output will break the computer out of its halted state. If not, then the UPS simply powers off the output, and waits for line power to return. > > I admit that we haven't kept good records on which UPSes do this, but it is fairly straightforward to test, and it should work on all but the cheapest models.Hi, this is exactly what I currently do. The question is if this nut shutdown script is the right place to put in the shutdown -h +0 or if I should use triggers or fiddle with the scheduler or ... and place it there. Cheers! -lutzn