[go: up one dir, main page]

File: init.d

package info (click to toggle)
upsd 2.5-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 216 kB
  • ctags: 114
  • sloc: ansic: 1,037; sh: 332; makefile: 104
file content (55 lines) | stat: -rw-r--r-- 1,273 bytes parent folder | download
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
#! /bin/sh
#
# This file was automatically customized by debmake on Thu, 12 Dec 1996 21:31:08 -0800
#
# Written by Miquel van Smoorenburg <miquels@drinkel.ow.org>.
# Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>.
# Modified for Debian by Christoph Lameter <clameter@debian.org>

# Uncomment and modify the following line to point to the ups serial device.
#PORT="/dev/ttyS3"
# Then comment out this line
echo "/etc/init.d/ups: Port not configured!";exit 0

PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/sbin/upsd

FLAGS="defaults 50"

test -f $DAEMON || exit 0

case "$1" in
  start)
    echo -n "Starting ups monitor: upsd"
    start-stop-daemon --start --quiet --exec $DAEMON -- $PORT
    echo .
    ;;
  stop)
    echo -n "Stoping ups monitor: upsd"
    start-stop-daemon --stop --quiet --exec $DAEMON
    echo .
    ;;
  restart|force-reload)
    echo -n "Restarting ups monitor: upsd"
    start-stop-daemon --stop --quiet --exec $DAEMON
    start-stop-daemon --start --quiet --exec $DAEMON -- $PORT
    echo .
    ;;
  poweroff)
    upsd -i-1 $PORT
    case "$?" in
      101 | 102)
	sleep 60
	upsd -k $PORT
        ;;
      *)
        ;;
    esac
    ;;
  *)
    echo "Usage: /etc/init.d/$0 {start|stop|poweroff}"
    exit 1
    ;;
esac

exit 0