Koozali.org: home of the SME Server
Obsolete Releases => SME Server 7.x => Topic started by: Arnie on July 15, 2009, 05:50:35 AM
-
Hello All!
I've recently configured a new Power Shield Defender 650VA UPS on my home SME server and it is working well. I would, however, like to change the shutdown behavior of the server.
At the moment, when the UPS goes to battery, the server continues to operate until the UPS sends the "battery low" warning, at which point it auto-shuts down. I would like to change the configuration so that the server will shut down 2 minutes after receiving the "on battery" signal.
What is the best way to achieve this?
Thanks in advance.
P.S. For those Aussies who are thinking about getting one of these UPS', I configured NUT to use the megatec_usb driver and set the port to "auto".
-
Hello All!
I've recently configured a new Power Shield Defender 650VA UPS on my home SME server and it is working well. I would, however, like to change the shutdown behavior of the server.
At the moment, when the UPS goes to battery, the server continues to operate until the UPS sends the "battery low" warning, at which point it auto-shuts down. I would like to change the configuration so that the server will shut down 2 minutes after receiving the "on battery" signal.
What is the best way to achieve this?
Thanks in advance.
P.S. For those Aussies who are thinking about getting one of these UPS', I configured NUT to use the megatec_usb driver and set the port to "auto".
Not sure if some external script is called but perhaps youc an make it sleep 2 minutes before starting the shutdown.
-
Arnie
I would like to change the configuration so that the server will shut down 2 minutes after receiving the "on battery" signal.
What is the best way to achieve this?
Look here
http://wiki.contribs.org/Uninterruptable_Power_Supply#Aditional_Information
and here
http://forums.contribs.org/index.php?topic=40668.0
The NUT website is here
http://www.networkupstools.org/
where you can glean which configuration setting does what
Then modify the NUT config file, by creating a custom template, expanding template and restarting service
-
Thanks for the advice mary.
It turns out that if you want a timed shutdown before the BATTLOW signal, you can't rely on upsmon, you have to configure upssched and have a script to handle the UPS events.
Anyway, I got it working now.
-
Arnie
Please share a more detailed answer with us, and it can be added to the wiki.
ie what was the script and where did you put it etc.
I expect your requirement may also be desirable to others in certain situations.
-
It turns out that if you want a timed shutdown before the BATTLOW signal, you can't rely on upsmon, you have to configure upssched and have a script to handle the UPS events.
Anyway, I got it working now.
How? Please share.
thanks
-
I did the following:
config setprop nut status enabled
config setprop nut Model megatec_usb
config setprop nut Type auto
/etc/e-smith/templates/etc/ups/upsmon.conf/NOTIFYCMD:
NOTIFYCMD /usr/sbin/upssched
/etc/e-smith/templates/etc/ups/upssched.conf/01CONFIG:
CMDSCRIPT /sbin/e-smith/nutUPS.cmd
PIPEFN /tmp/upspipe
LOCKFN /tmp/upslock
AT COMMBAD * EXECUTE commbad
AT COMMOK * EXECUTE commok
AT NOCOMM * EXECUTE nocomm
AT ONBATT * EXECUTE powerout
AT ONBATT * START-TIMER shutdownnow 60 <------ Set this to how many seconds after ONBATT signal you want to shut down
AT LOWBATT * EXECUTE shutdowncritical
AT ONLINE * CANCEL-TIMER shutdownnow
AT ONLINE * EXECUTE powerup
/sbin/e-smith/nutUPS.cmd:
#! /bin/sh
case $1 in
commbad)
/bin/echo "UPS communications failure on `date`." | /bin/mail -s"UPS communications LOST" admin
/usr/bin/wall "UPS communications failure."
;;
commok)
/bin/echo "UPS communications restored on `date`." | /bin/mail -s"UPS communications restored" admin
/usr/bin/wall "UPS communications restored."
;;
nocomm)
/bin/echo "UPS communications cannot be established on `date`." | /bin/mail -s"UPS uncontactable" admin
/usr/bin/wall "UPS communications cannot be established."
;;
powerout)
/bin/echo "Power failure on `date`." | /bin/mail -s"UPS on battery" admin
/usr/bin/wall "UPS on battery. Shutdown in 60 seconds...."
;;
shutdownnow)
/bin/echo "UPS has been on battery for 60 seconds. Starting orderly shutdown on `date`." | /bin/mail -s"UPS on battery for 60 seconds" admin
/usr/bin/wall "UPS has been on battery for 60 seconds. Shutting down NOW!!!!"
/usr/bin/sudo /sbin/e-smith/signal-event halt
;;
shutdowncritical)
/bin/echo "UPS battery level CRITICAL. Starting EMERGENCY shutdown on `date`." | /bin/mail -s"UPS battery CRITICAL" admin
/usr/bin/wall "UPS battery level CRITICAL. Shutting down NOW!!!!"
/usr/bin/sudo /sbin/e-smith/signal-event halt
;;
powerup)
/bin/echo "Power restored on `date`." | /bin/mail -s"UPS on line" admin
/usr/bin/wall "UPS on line. Shutdown aborted."
;;
*)
/bin/echo "Unrecognized command: $1"
;;
esac
/etc/e-smith/templates/etc/sudoers/30nut:
nut ALL=NOPASSWD: ALL
signal-event post-upgrade
signal-event reboot
It ain't pretty, but it works. :P
-
did you edit directly /etc/e-smith/templates/etc/ups/upssched.conf/ files?
that's wrong.. you'd create the same fragments in /etc/e-smith/templates-custom/etc/ups/upssched.conf/ dir, otherwise your customizations will be lost at the first update.
Stefano
-
Who does updates???????
:lol: :lol: :lol: :lol: :lol: :lol:
-
Added here
http://wiki.contribs.org/Uninterruptable_Power_Supply#Modifying_shutdown_time_delay
Would someone please review it, as I have not yet had time or the opportunity to test the instructions myself.
-
config setprop nut Model megatec_usb
config setprop nut Type auto
Those two lines are specific to the Power Shield Defender 650VA and other compatible UPS' with a USB port. It may be better to leave those lines out and have the user figure out which drivers work for their UPS.