File: upsmon.in

package info (click to toggle)
nut 2.2.2-6.5
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 6,240 kB
  • ctags: 4,918
  • sloc: ansic: 42,528; sh: 10,284; makefile: 860
file content (56 lines) | stat: -rw-r--r-- 1,015 bytes parent folder | download | duplicates (10)
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
#!/bin/sh
#
# chkconfig: 2345 31 89
#
# 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: @sysconfdir@/upsmon.conf

PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH

# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/ups ]; then
  . /etc/sysconfig/ups
else
  POWERDOWNFLAG=/etc/killpower
  NUTUSER=nutmon
fi

# 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