blob: d9cac06863eef377cb9c61150b3ffafdc4bde424 (
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
|
#! /bin/sh
#
# dante SOCKS server init.d file. Based on /etc/init.d/skeleton:
# Version: @(#)skeleton 1.8 03-Mar-1998 miquels@cistron.nl
# NAME of this script may be `danted' or `danted-authenticating'
NAME=$(basename $0)
# If basename is like "S20danted", then strip the first 3 characters
if echo $NAME | grep -q '^[SK][0-9][0-9]'
then
NAME=`echo $NAME | cut -c 4-`
fi
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/danted
DESC="Dante SOCKS daemon"
CONFFILE=/etc/$NAME.conf
# danted always writes PIDFILE to /var/run/danted.pid, even when started
# multiple times with different config files! So we need to keep our own
# lockfiles separately.
PIDFILE=/var/run/initscript-lockfiles/$NAME.pid
test -f $DAEMON || exit 0
test -f $CONFFILE || { echo "error: $CONFFILE does not exist" 1>&2; exit 2; }
test -d `dirname "$PIDFILE"` || mkdir -p `dirname "$PIDFILE"`
set -e
case "$1" in
start)
echo "Starting $DESC: $NAME"
start-stop-daemon --start --pidfile $PIDFILE \
--startas $DAEMON --make-pidfile --background \
-- -f $CONFFILE
;;
stop)
echo "Stopping $DESC: $NAME"
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
rm -f "$PIDFILE"
;;
reload|force-reload)
echo "Reloading $DESC: $NAME configuration files."
start-stop-daemon --stop --signal 1 --quiet \
--pidfile $PIDFILE
;;
restart)
echo "Restarting $DESC: $NAME"
start-stop-daemon --stop --quiet --pidfile $PIDFILE || :
rm -f "$PIDFILE"
sleep 1
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--startas $DAEMON --make-pidfile --background \
-- -f $CONFFILE
;;
*)
N=/etc/init.d/$NAME
# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
|