NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
Infinite
Nov 15, 2009Aspirant
NUT on OSX 10.6 [Sharing a UPS with ReadyNAS and Computers]
First off: I can not take much credit for this post, the majority of this write up was done by Egg in this post "NUT on OS X (10.5.7)" which was priceless in my effort to get this matter solved. It ...
Pian
Nov 05, 2010Aspirant
And (perhaps slightly more usefully!) here is my UPS:
#!/bin/sh
##
# UPS Monitor script
# Using Network UPS Tools executables
##
. /etc/rc.common
FINK_BIN="/sw/sbin"
StartService ()
{
ConsoleMessage "Starting NUT (UPS Service)"
if [ -n "`ps acxw | grep -i "upsmon" | awk {'print $1'}`" ]; then
ConsoleMessage -f "NUT (UPS Service)"
echo "Failed to start NUT (UPS Service): It is already running."
exit 0
fi
${FINK_BIN}/upsmon &
if [ -n "`ps acxw | grep -i "upsmon" | awk {'print $1'}`" ]; then
ConsoleMessage -s "NUT (UPS Service)"
echo "NUT (UPS Service) successfully started."
exit 0
else
ConsoleMessage -f "NUT (UPS Service)"
echo "Failed to start NUT (UPS Service): Either the application has been deleted or it has no execution right."
exit 0
fi
}
StopService ()
{
ConsoleMessage "Stopping NUT (UPS Service)"
if [ -z "`ps acxw | grep -i "upsmon" | awk {'print $1'}`" ]; then
ConsoleMessage -s "NUT (UPS Service)"
echo "Failed to stop NUT (UPS Service): It is not running."
exit 0
fi
${FINK_BIN}/upsmon -c stop
if [ -n "`ps acxw | grep -i "upsmon" | awk {'print $1'}`" ]; then
ConsoleMessage -s "NUT (UPS Service)"
echo "Failed to stop NUT (UPS Service) out of unknown reason."
exit 0
else
ConsoleMessage -s "NUT (UPS Service)"
echo "NUT (UPS Service) successfully stopped."
exit 0
fi
}
StopServiceForcefully()
{
ConsoleMessage "Stopping NUT (UPS Service)"
if [ -z "`ps acx | grep -i "upsmon" | awk {'print $1'}`" ]; then
echo "Failed to stop NUT (UPS Service): It is not running."
else
kill -kill `ps acxw | grep -i "upsmon" | awk {'print $1'}`
if [ -n "`ps acxw | grep -i "upsmon" | awk {'print $1'}`" ]; then
echo "Failed to stop NUT (UPS Service) out of unknown reason."
else
echo "NUT (UPS Service) successfully stopped."
fi
fi
}
RestartService()
{
ConsoleMessage "Trying to restart NUT (UPS Service)."
StopService
StartService
exit 0
}
RunService "$1"
#!/bin/sh
##
# UPS Monitor script
# Using Network UPS Tools executables
##
. /etc/rc.common
FINK_BIN="/sw/sbin"
StartService ()
{
ConsoleMessage "Starting NUT (UPS Service)"
if [ -n "`ps acxw | grep -i "upsmon" | awk {'print $1'}`" ]; then
ConsoleMessage -f "NUT (UPS Service)"
echo "Failed to start NUT (UPS Service): It is already running."
exit 0
fi
${FINK_BIN}/upsmon &
if [ -n "`ps acxw | grep -i "upsmon" | awk {'print $1'}`" ]; then
ConsoleMessage -s "NUT (UPS Service)"
echo "NUT (UPS Service) successfully started."
exit 0
else
ConsoleMessage -f "NUT (UPS Service)"
echo "Failed to start NUT (UPS Service): Either the application has been deleted or it has no execution right."
exit 0
fi
}
StopService ()
{
ConsoleMessage "Stopping NUT (UPS Service)"
if [ -z "`ps acxw | grep -i "upsmon" | awk {'print $1'}`" ]; then
ConsoleMessage -s "NUT (UPS Service)"
echo "Failed to stop NUT (UPS Service): It is not running."
exit 0
fi
${FINK_BIN}/upsmon -c stop
if [ -n "`ps acxw | grep -i "upsmon" | awk {'print $1'}`" ]; then
ConsoleMessage -s "NUT (UPS Service)"
echo "Failed to stop NUT (UPS Service) out of unknown reason."
exit 0
else
ConsoleMessage -s "NUT (UPS Service)"
echo "NUT (UPS Service) successfully stopped."
exit 0
fi
}
StopServiceForcefully()
{
ConsoleMessage "Stopping NUT (UPS Service)"
if [ -z "`ps acx | grep -i "upsmon" | awk {'print $1'}`" ]; then
echo "Failed to stop NUT (UPS Service): It is not running."
else
kill -kill `ps acxw | grep -i "upsmon" | awk {'print $1'}`
if [ -n "`ps acxw | grep -i "upsmon" | awk {'print $1'}`" ]; then
echo "Failed to stop NUT (UPS Service) out of unknown reason."
else
echo "NUT (UPS Service) successfully stopped."
fi
fi
}
RestartService()
{
ConsoleMessage "Trying to restart NUT (UPS Service)."
StopService
StartService
exit 0
}
RunService "$1"
Related Content
NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!