File: ipband.init

package info (click to toggle)
ipband 0.8.1-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 236 kB
  • ctags: 179
  • sloc: ansic: 1,679; sh: 117; makefile: 103
file content (68 lines) | stat: -rw-r--r-- 1,678 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
56
57
58
59
60
61
62
63
64
65
66
67
68
#! /bin/sh
### BEGIN INIT INFO
# Provides:          ipband
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: ipband daemon
# Description:       This is a daemon which can monitor as many different subnets (or individual
#                    hosts, by specifying a "subnet" of /32) as you'd like.
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/ipband
NAME=ipband
DESC=ipband

set -e

test -x $DAEMON || exit 0

if [ -r /etc/default/ipband ]; then
    . /etc/default/ipband
else
    printf "/etc/default/ipband is not readable, not starting ipband.\n"
    exit 0
fi

case "$1" in
  start)
        printf "Starting $DESC:"
	for config_file in $CONFIG_FILES; do
	    if [ ! -r "$config_file" ]; then
		[ "$CONFIG" = "true" ] || CONFIG="false"
	    else
		CONFIG="true"
		IDENTIFIER="$(printf "$config_file" | tr / _)"
		mkdir -p /var/run/ipband
		start-stop-daemon --start --background --make-pidfile \
		    --quiet --pidfile "/var/run/ipband/$IDENTIFIER.pid" \
		    --exec $DAEMON -- $FLAGS -c "$config_file"
		printf " $config_file"
	    fi
	done
	[ "$CONFIG" = "false" ] && printf " no configuration files found"
	printf ".\n"
	;;
  stop)
	printf "Stopping $DESC: "
	for pid_file in /var/run/ipband/*.pid; do
	    if [ ! -f "$pid_file" ]; then continue; fi
	    start-stop-daemon --oknodo --stop --quiet --pidfile "$pid_file" \
		--exec $DAEMON -- $FLAGS
	done
	printf "$NAME.\n"
	;;
  restart|force-reload)
	$0 stop || true
	$0 start
	;;
  *)
	N=/etc/init.d/$NAME
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0