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
|
#!/bin/sh
#
# chkconfig: 2345 31 89
#
# 2022-01-04 Jim Klimov <jimklimov+nut@gmail.com>
# Updated .in template, double-quoted variable expansions
#
# 2003-01-31 Antonino Albanese <al.an@monkeysweb.net>
# start program as user nut
# new style stopping upsmon
# added reload option
#
# description: upsmon talks to upsd and notifies of ups status changes \
# also shutting systems down if required.
# processname: upsmon
# config: @CONFPATH@/upsmon.conf
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
# Source function library.
. /etc/rc.d/init.d/functions
NUT_SBINDIR="@SBINDIR@"
if [ -f /etc/sysconfig/ups ]; then
. /etc/sysconfig/ups
else
POWERDOWNFLAG="@POWERDOWNFLAG@"
NUTUSER="@RUN_AS_USER@"
fi
if [ -n "$NUT_SBINDIR" -a -d "$NUT_SBINDIR" ]; then
PATH="$NUT_SBINDIR:$PATH"
fi
NUT_QUIET_INIT_UPSNOTIFY=true
export NUT_QUIET_INIT_UPSNOTIFY
# See how we are called.
case "$1" in
start)
action "NUT Starting UPS monitor" upsmon -u "$NUTUSER"
touch /var/lock/subsys/upsmon
;;
stop)
action "NUT Stopping UPS monitor: " \
upsmon -c stop
rm -f /var/lock/subsys/upsmon
;;
restart)
$0 stop
$0 start
;;
reload)
action "NUT Reloading UPS monitor: " \
upsmon -c reload
;;
status)
status upsmon
;;
*)
echo "Usage: upsmon {start|stop|restart|reload|status}"
exit 1
esac
|