summaryrefslogtreecommitdiff
path: root/examples/debian.conntrackd.init.d
blob: ba847dd79c72917a3b0a145fedf7abbd99a78847 (plain)
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
#!/bin/sh
#
# /etc/init.d/conntrackd
#
# Maximilian Wilhelm <max@rfc2324.org>
#  -- Mon, 06 Nov 2006 18:39:07 +0100
#

export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

NAME="conntrackd"
DAEMON=`command -v conntrackd`
CONFIG="/etc/conntrack/conntrackd.conf"
PIDFILE="/var/run/${NAME}.pid"


# Gracefully exit if there is no daemon (debian way of life)
if [ ! -x "${DAEMON}" ]; then
	exit 0
fi

# Check for config file
if [ ! -f /etc/conntrackd/conntrackd.conf ]; then
	echo "Error: There is no config file for $NAME" >&2
	exit 1;
fi

case "$1" in
  start)
        echo -n "Starting $NAME: "
	start-stop-daemon --start --quiet --make-pidfile --pidfile "/var/run/${NAME}.pid" --background --exec "${DAEMON}"  && echo "done." || echo "FAILED!"
	;;
  stop)
        echo -n "Stopping $NAME:"
	start-stop-daemon --stop --quiet --oknodo --pidfile "/var/run/${NAME}.pid" && echo "done." || echo "FAILED!"
	;;

  restart)
	$0 start
	$0 stop
	;;

  *)
	echo "Usage: /etc/init.d/conntrackd {start|stop|restart}"
	exit 1
esac

exit 0