|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /etc/init.d/ |
Upload File : |
#! /bin/sh
#
# apcupsd This shell script takes care of starting and stopping
# the apcupsd UPS monitoring daemon.
#
# chkconfig: 2345 60 99
# description: apcupsd monitors power and takes action if necessary
#
APCPID=/var/run/apcupsd.pid
# Source function libarary
. /etc/rc.d/init.d/functions
case "$1" in
start)
rm -f /etc/apcupsd/powerfail
rm -f /etc/nologin
echo -n "Starting UPS monitoring:"
daemon /sbin/apcupsd -f /etc/apcupsd/apcupsd.conf
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/apcupsd
;;
stop)
echo -n "Shutting down UPS monitoring:"
killproc apcupsd
echo
rm -f $APCPID
rm -f /var/lock/subsys/apcupsd
;;
restart|force-reload)
$0 stop
sleep 15
$0 start
;;
reload)
echo "$0: reload not implemented"
exit 3
;;
status)
status apcupsd
RETVAL=$?
if [ $RETVAL -eq 0 ]
then
/sbin/apcaccess status
else
exit $RETVAL
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
exit 0