1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
#!/sbin/sh
#init.d script to start nut services for IPP - Unix on Solaris
# Customizations copyright (c) 2015, by Eaton (R) Corporation. All rights reserved.
NUT_DIR="/usr/local/ups"
LD_LIBRARY_PATH="$NUT_DIR/lib"
export LD_LIBRARY_PATH
SHUTDOWN_TIMER=-1
if [ -f ${NUT_DIR}/etc/ipp.conf ]; then
. ${NUT_DIR}/etc/ipp.conf
fi
ups_stop () {
pkill -n upsmon
pkill -n upsd
"$NUT_DIR"/bin/upsdrvctl stop > /dev/null 2>&1
}
ups_start () {
echo "in ups start function"
"$NUT_DIR"/bin/upsdrvctl start #> /dev/null 2>&1
"$NUT_DIR"/sbin/upsd #> /dev/null 2>&1
if [ "$SHUTDOWN_TIMER" -gt -1 ]; then
# This host wants early shutdown support, must be root
${NUT_DIR}/sbin/upsmon -p #> /dev/null 2>&1
else
${NUT_DIR}/sbin/upsmon #> /dev/null 2>&1
fi
"$NUT_DIR"/init #> /dev/null 2>&1
}
case $1 in
'start')
ups_start
;;
'stop')
ups_stop
;;
'restart')
ups_stop
while pgrep upsd > /dev/null
do
sleep 1
done
while pgrep upsmon > /dev/null
do
sleep 1
done
while pgrep netxml-ups > /dev/null
do
sleep 1
done
while pgrep snmp-ups > /dev/null
do
sleep 1
done
ups_start
;;
*)
echo ""
echo "Usage: '$0' {start | stop | restart }"
echo ""
exit 64
;;
esac
exit $?
|