]> git.pld-linux.org Git - packages/nut.git/blame - nut.init
- force to use openssl >= 0.9.7, idea by kloczek
[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
3132bf7d
TO
30 show "Starting UPS drivers"
31 daemon /usr/lib/nut/upsdrvctl start
32 if [ $? -eq 0 ]; then
33 msg_starting "UPS network daemon"
34 daemon "upsd $OPTIONS"
35 RETVAL=$?
36 touch /var/lock/subsys/ups
37 fi
eca6ebe0 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
3132bf7d
TO
46 show "Stopping UPS drivers"
47 daemon /usr/lib/nut/upsdrvctl stop
bb94ceb4 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 58 reload)
3132bf7d
TO
59 msg_reloading "UPS drivers"
60 daemon /usr/lib/nut/upsdrvctl reload
bb94ceb4
AM
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
8ecf50f9 70 /usr/lib/nut/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.043261 seconds and 4 git commands to generate.