summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/support/modules/network_test_server/files/init/danted-authenticating
blob: 9f9084c337bc31c552e7a22b9faf3336bf358ee6 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#! /bin/sh
#
# dante SOCKS server init.d file. Based on /etc/init.d/skeleton:
# Version:	@(#)skeleton  1.8  03-Mar-1998  miquels@cistron.nl

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/danted
NAME=$(basename $0)     # may be `danted', `danted-authenticating', etc. Note: In boot it's 'S20danted-authenticating' etc.
DESC="Dante SOCKS daemon"
PIDFILE=/var/run/qt_danted-authenticating.pid
CONFFILE=/etc/danted-authenticating.conf

test -f $DAEMON   || exit 0
test -f $CONFFILE || { echo "error: $CONFFILE does not exist" 1>&2; exit 2; }

set -e

case "$1" in
  start)
	echo -n "Starting $DESC: "
	start-stop-daemon --start --quiet --pidfile $PIDFILE \
		--startas $DAEMON --make-pidfile --background \
		-- -f $CONFFILE
	echo "$NAME."
	;;
  stop)
	echo -n "Stopping $DESC: "
	start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
	echo "$NAME."
	;;
  reload|force-reload)
	echo "Reloading $DESC configuration files."
	start-stop-daemon --stop --signal 1 --quiet --pidfile \
		$PIDFILE
  ;;
  restart)
	echo -n "Restarting $DESC: "
	start-stop-daemon --stop --quiet --pidfile $PIDFILE || :
	sleep 1
	start-stop-daemon --start --quiet --pidfile $PIDFILE \
	  --startas $DAEMON --make-pidfile --background      \
	  -- -f $CONFFILE
	echo "$NAME."
	;;

  status)
        echo -n "Showing status of $DESC: "
        if [ -f $PIDFILE ]; then
            PID=`cat $PIDFILE`
            if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then
                printf "%s\n" "Process dead but pidfile exists"
                exit 1
            else
                echo "Running"
                exit 0
            fi
        else
            printf "%s\n" "Service not running"
            exit 1
        fi
        ;;
  *)
	N=/etc/init.d/danted-authenticating
	# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0