[Nut-upsuser] Shutdown script fails
Moorcroft, Mark (ARC-TSM)[ERC, Inc.]
mark.moorcroft at nasa.gov
Fri May 11 00:55:27 UTC 2012
I can give user “ups” a login shell and am able to run my shutdown script as ups. But when I pull the power plug I get the following..
May 10 16:53:52 banyan upsmon[15305]: UPS tripplite at localhost on battery
May 10 16:53:52 banyan upssched[16564]: Timer daemon started
May 10 16:53:52 banyan upssched[16564]: New timer: onbatt (20 seconds)
May 10 16:54:12 banyan upssched[16564]: Event: onbatt
May 10 16:54:13 banyan upssched[16564]: exec_cmd(/usr/bin/upssched-cmd onbatt) returned 1
May 10 16:54:28 banyan upssched[16564]: Timer queue empty, exiting
May 10 16:54:52 banyan upsmon[15305]: UPS tripplite at localhost on line power
I know the script works because I can run it manually. I don’t even get the logger event. Upsmon runs as user ups. Do I need sudo in there someplace and an entry added to sudoers? Does it try to run upssched-cmd as root?
--
Mark Moorcroft
ERC Corp.
650-604-4784
mailto:mark.moorcroft at nasa.gov
In order for the ups script to shut down the nodes it will presumably run
a tentakel or rocks run host command. What is the best safe strategy to
give root access for that run command. Presumably upsmon has root by some
mechanism already for fsd. I have tested a power loss already and can see
the onbatt timer start and complete in /var/log/daemon, but I have not
seen that logger is working and of course the tentakel is not running
either yet. The shutdown of the head node (upsmon -c fsd) was working when
the onbatt timer finishes until I removed it for debugging. Since the testing I added the full path to logger as seen here but the sample script didn¹t include it. It cleans up
after itself so I have no debugging remnants left in
/var/run/nut/upssched, which is where the FIFO is.
vim /usr/bin/upssched-cmd
#! /bin/sh
#
# This script should be called by upssched via the CMDSCRIPT directive.
#
# Here is a quick example to show how to handle a bunch of possible
# timer names with the help of the case structure.
#
# This script may be replaced with another program without harm.
#
# The first argument passed to your CMDSCRIPT is the name of the timer
# from your AT lines.
case $1 in
upsgone)
/usr/bin/logger -t upssched-cmd "The UPS has been gone for
awhile"
;;
onbatt)
/usr/bin/logger -t upssched-cmd "Shutting Down Cluster"
/opt/rocks/bin/tentakel /sbin/poweroff
;;
*)
/usr/bin/logger -t upssched-cmd "Unrecognized command: $1"
;;
esac
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20120510/a9af1049/attachment.html>
More information about the Nut-upsuser
mailing list