File: ipband.init

package info (click to toggle)
ipband 0.7.2-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 212 kB
  • ctags: 167
  • sloc: ansic: 1,580; sh: 93; makefile: 78
file content (57 lines) | stat: -rw-r--r-- 1,241 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
#! /bin/sh

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 / _)"
		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