File: dns2tcp.init

package info (click to toggle)
dns2tcp 0.5.2-1.1
  • links: PTS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 1,012 kB
  • ctags: 717
  • sloc: ansic: 5,301; sh: 3,617; makefile: 60
file content (102 lines) | stat: -rw-r--r-- 1,625 bytes parent folder | download | duplicates (2)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/sh
### BEGIN INIT INFO
# Provides:          dns2tcp
# Required-Start:    $local_fs $network $remote_fs
# Required-Stop:     $local_fs $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: dns2tcp server init script
# Description:       This file should be used to start and stop dns2tcp server.
### END INIT INFO

# Author: Arnaud Cornet <acornet@debian.org>

PATH=/sbin:/usr/sbin:/bin:/usr/bin
CONFIG=/etc/dns2tcpd.conf
OLDDAEMON=/usr/sbin/dns2tcpd
DAEMON=/usr/bin/dns2tcpd
USER=nobody
ENABLED=0

if ! test -x $DAEMON ; then
	if ! test -x $OLDDAEMON ; then
		exit 0
	else
		DAEMON=$OLDDAEMON
	fi
fi
test -f $CONFIG || exit 0

if [ -e /etc/default/dns2tcp ]; then
	. /etc/default/dns2tcp
fi

test "$ENABLED" != "0" || exit 0

. /lib/lsb/init-functions

dns2tcpd_start()
{
	start-stop-daemon --start --exec $DAEMON -- -f "$CONFIG" || return 2
	return 0
}

dns2tcpd_stop()
{
	start-stop-daemon --stop -u $USER --exec $DAEMON -- || return 2
	return 0
}

case "$1" in
start)
	log_daemon_msg "Starting dns2tcp" "dns2tcpd"
	dns2tcpd_start
	case "$?" in
	0)
		log_end_msg 0
		;;
	1)
		log_end_msg 1 
		echo "dns2tcpd not started."
		;;
	2)
		log_end_msg 1
		;;
	esac
	;;
stop)
	log_daemon_msg "Stopping dns2tcp" "dns2tcpd"
	dns2tcpd_stop
	case "$?" in
	0|1)
		log_end_msg 0
		;;
	2)
		log_end_msg 1
		;;
	esac
	;;

reload|force-reload|restart)
	log_daemon_msg "Restarting dns2tcp" "dns2tcpd"
	dns2tcpd_stop
	dns2tcpd_start
	case "$?" in
	0)
		log_end_msg 0
		;;
	1)
		log_end_msg 1
		;;
	2)
		log_end_msg 1
		;;
	esac
	;;
*)
	echo "Usage: $0 {start|stop|reload|restart}"
	exit 3
	;;
esac

: