]> git.pld-linux.org Git - packages/nut.git/blame - nut.init
- fideltronik patch fixed, now works
[packages/nut.git] / nut.init
CommitLineData
eca6ebe0
SZ
1#!/bin/sh
2#
3# ups NUT - Network UPS Tools daemon
4#
5# chkconfig: 2345 10 90
6#
7# description: The ups daemon monitors an UPS and makes information about
8# it's status available to other programs
9# processname: upsd
10# config: /etc/ups/
11
12# Source function library.
13. /etc/rc.d/init.d/functions
14
15# Get network config
16. /etc/sysconfig/network
17
18# Get config.
19[ -f /etc/sysconfig/ups ] && . /etc/sysconfig/ups
20
21[ -n "$PORT" ] && OPTIONS="-p $PORT"
22[ -n "$TCP_PORT" ] && OPTIONS="-t $TCP_PORT"
23[ -n "$BIND_ADDRESS" ] && OPTIONS="$OPTIONS -i $BIND_ADDRESS"
24
25# See how we are called.
26case "$1" in
27 start)
28 # Check if the service is already running?
29 if [ ! -f /var/lock/subsys/ups ]; then
bb94ceb4
AM
30 show "Starting UPS drivers"
31 daemon upsdrvctl start
eca6ebe0 32 if [ $? -eq 0 ]; then
bb94ceb4
AM
33 msg_starting "UPS network daemon"
34 daemon "upsd $OPTIONS"
35 RETVAL=$?
eca6ebe0 36 touch /var/lock/subsys/ups
eca6ebe0
SZ
37 fi
38 else
bb94ceb4 39 msg_Already_Running "UPS drivers and network daemon"
eca6ebe0
SZ
40 fi
41 ;;
42 stop)
43 if [ -f /var/lock/subsys/ups ]; then
44 msg_stopping "UPS daemon"
45 killproc upsd
eca6ebe0 46 show "Stopping UPS drivers"
bb94ceb4
AM
47 daemon upsdrvctl stop
48 RETVAL=$?
eca6ebe0
SZ
49 rm -f /var/lock/subsys/ups
50 else
51 msg_Not_Running "UPS daemon"
52 fi
53 ;;
54 restart)
55 $0 stop
56 $0 start
57 ;;
bb94ceb4
AM
58 reload)
59 msg_reloading "UPS drivers"
60 daemon upsdrvctl reload
61 msg_reloading "UPS network daemon"
62 daemon upsd -c reload
63 ;;
eca6ebe0
SZ
64 force-reload)
65 $0 restart
66 exit $?
67 ;;
68 status)
69 status upsd
bb94ceb4 70 upsdrvctl status
eca6ebe0
SZ
71 ;;
72 *)
73 msg_Usage "$0 {start|stop|status|restart|reload|force-reload}"
74 exit 1
75 ;;
76esac
77exit $RETVAL
78
This page took 0.037243 seconds and 4 git commands to generate.