File: arpalert-debian.in

package info (click to toggle)
arpalert 2.0.3-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,332 kB
  • ctags: 415
  • sloc: ansic: 4,185; sh: 447; makefile: 153; perl: 28
file content (52 lines) | stat: -rwxr-xr-x 1,171 bytes parent folder | download | duplicates (8)
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
#!/bin/bash
prefix="@prefix@"
exec_prefix="@exec_prefix@"
BIN="@sbindir@/arpalert"
CONF="@sysconfdir@/arpalert/arpalert.conf"

# check binary file
if ! test -f $BIN; then
	echo "arpalert ERROR: program not installed"
	exit 1
fi

# check config file
if ! test -f $CONF; then
	echo "arpalert ERROR: config file not found [$CONF]"
	exit 1
fi

# get pid file in conf
PID=$(grep -i "^[[:space:]]*LOCK[[:space:]]\+FILE[[:space:]]\+=[[:space:]]\+" < $CONF | \
      sed -e "s/^.*[[:space:]]\+=[[:space:]]\+//")

if test "x$PID" = "x"; then
	echo "arpalert ERROR: pid file not found in config file"
	exit 1
fi

case "$1" in
	start)
		echo -n "Starting arpalert"
		start-stop-daemon --start --quiet --pidfile $PID --name arpalert --startas $BIN -- -d -f $CONF
		echo "."
	;;

	stop)
		echo -n "Stopping arpalert"
		start-stop-daemon --stop --quiet --pidfile $PID --name arpalert
		echo "."
	;;

	restart)
		echo -n "Restarting arpalert"
		start-stop-daemon --stop --retry 5 --quiet --pidfile $PID --name arpalert
		start-stop-daemon --start --quiet --pidfile $PID --name arpalert --startas $BIN -- -d -f $CONF
		echo "."
	;;

	*)
		echo "Usage: $0 {start|stop|restart}"
	;;
esac