<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><div><br></div><div>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..</div><div><br></div><div><div>May 10 16:53:52 banyan upsmon[15305]: UPS tripplite@localhost on battery</div><div>May 10 16:53:52 banyan upssched[16564]: Timer daemon started</div><div>May 10 16:53:52 banyan upssched[16564]: New timer: onbatt (20 seconds)</div><div>May 10 16:54:12 banyan upssched[16564]: Event: onbatt </div><div>May 10 16:54:13 banyan upssched[16564]: exec_cmd(/usr/bin/upssched-cmd onbatt) returned 1</div><div>May 10 16:54:28 banyan upssched[16564]: Timer queue empty, exiting</div><div>May 10 16:54:52 banyan upsmon[15305]: UPS tripplite@localhost on line power</div><div><br></div></div><div><br></div><div>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?</div><div><br></div><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-family: Helvetica; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
-- </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
Mark Moorcroft</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
ERC Corp.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
650-604-4784</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
<a href="mailto:mark.moorcroft@nasa.gov">mailto:mark.moorcroft@nasa.gov</a></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br class="khtml-block-placeholder"></div></div><br class="Apple-interchange-newline"></span></div><br class="Apple-interchange-newline"></div></div></div><span id="OLK_SRC_BODY_SECTION"><div><div text="#000000" bgcolor="#ffffff"><div><pre wrap="">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
</pre></div></div></div></span></body></html>