]> git.pld-linux.org Git - packages/nut.git/blame - nut.init
- poprawki
[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
30 show "Starting UPS drivers"
31 busy
32 ups_start >/dev/null 2>&1
33 if [ $? -eq 0 ]; then
34 ok
35 msg_starting "UPS daemon"
36 daemon "upsd $OPTIONS\""
37 touch /var/lock/subsys/ups
38 else
39 fail
40 fi
41 else
42 msg_Already_Running "UPS daemon"
43 fi
44 ;;
45 stop)
46 if [ -f /var/lock/subsys/ups ]; then
47 msg_stopping "UPS daemon"
48 killproc upsd
49
50 show "Stopping UPS drivers"
51 busy
52 ups_stop >/dev/null 2>&1
53 if [ $? -eq 0 ]; then
54 ok
55 else
56 fail
57 fi
58 rm -f /var/lock/subsys/ups
59 else
60 msg_Not_Running "UPS daemon"
61 fi
62 ;;
63 restart)
64 $0 stop
65 $0 start
66 ;;
67 force-reload)
68 $0 restart
69 exit $?
70 ;;
71 status)
72 status upsd
73 ups_status
74 ;;
75 *)
76 msg_Usage "$0 {start|stop|status|restart|reload|force-reload}"
77 exit 1
78 ;;
79esac
80exit $RETVAL
81
This page took 0.031238 seconds and 4 git commands to generate.