[Nut-upsuser] upssched-cmd wrong call [SOLVED]
Konstantin 'Kastus' Shchuka
kastus at epocrates.com
Tue Oct 18 22:37:32 UTC 2005
A short recap of the problem:
The script specified in CMDSCRIPT in upssched.conf generates an error
upon its invocation in the form
Execute command failure: <script name>: No such file or directory
The script exists and is executable.
In my case, the script contained the following stanza:
case $1 in
onbatt)
/sbin/shutdown -h now
;;
When UPS goes on battery, upsmon (which runs as a non-privileged user nutmon)
invokes upssched which in its turn runs as user nutmon, too.
This is controlled by the line in upssched.conf
AT ONBATT * START-TIMER onbatt 90
Upon expiration of 90 seconds timeout, upssched attempts to execute
CMDSCRIPT with parameter "onbatt". Remember, upssched is running as
user nutmon. Scripts starts execution all right, but shutdown is a
privileged command which can be run as root only (without tweaking
security settings and allowing regular user to shut down the system).
This is the point where the script breaks and returns a non-zero error
code to upssched which is somehow interpreted as "No such file or directory".
The solution was in following http://www.networkupstools.org/doc/2.0.1/upssched.html
to the letter and using "upsmon -c fsd" to shut down the system instead of
"/sbin/shutdown -h now".
--
Kastus Shchuka
Unix System Administrator
Epocrates Inc.
tel 650.227.1786
fax 650.592.6995
More information about the Nut-upsuser
mailing list