blob: 74c95ca56d5d2c0d46cf7d3ee0259db09fe11267 (
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
|
#!/bin/sh
#
# /etc/rc.d/rc.sslh
#
# Start/stop/restart the sslh daemon.
#
NAME="sslh"
config="/etc/${NAME}/${NAME}.cfg"
pidfile="/var/run/${NAME}.pid"
start() {
if [[ -z $(pidof -o %PPID $NAME) ]]; then
rm $pidfile &>/dev/null
fi
if [ ! -f $pidfile ]; then
echo "Start services: $NAME"
${NAME} -F $config >/dev/null 2>&1
else
echo "Services $NAME already running."
fi
}
stop() {
if [ -f $pidfile ]; then
echo "Stop services: $NAME"
kill $(cat $pidfile) >/dev/null 2>&1
rm $pidfile &>/dev/null
else
echo "Services $NAME is not running."
fi
}
restart() {
stop
sleep 2
start
}
case $1 in
'start')
start
;;
'stop')
stop
;;
'restart')
restart
;;
*)
echo "Usage $0 {start|stop|restart}"
esac
|