blob: d3326f4c3a5d8ea75b048645418e5dd416dad637 (
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
|
#! /bin/sh
### BEGIN INIT INFO
# Provides: go-tcp-proxy
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts proxy to access mariadb from kvm guests.
# Description: Starts proxy to access mariadb from kvm guests.
### END INIT INFO
NAME="go-tcp-proxy"
PIDFILE="/var/run/${NAME}.pid"
DAEMON="/usr/local/bin/go-tcp-proxy"
START_OPTS="--start --background --make-pidfile --pidfile ${PIDFILE} --chuid nobody --exec $DAEMON -- -l -r"
END_OPTS="--stop --pidfile ${PIDFILE}"
case "$1" in
start)
echo "Starting $DAEMON"
start-stop-daemon $START_OPTS
;;
stop)
echo "Stopping $NAME"
start-stop-daemon $END_OPTS
rm -f "${PIDFILE}"
;;
restart)
echo "Restarting $NAME"
"$0" stop
sleep 1
"$0" start
;;
status)
if cat $PIDFILE 1>/dev/null 2>/dev/null; then
echo "$NAME is running."
else
echo "$NAME does not run."
fi
;;
*)
echo "Usage: /etc/init.d/tcp-proxy.sh {start|stop|restart|status}"
exit 1
;;
esac
exit 0
|