aboutsummaryrefslogtreecommitdiff
path: root/network/sslh/rc.sslh
blob: 38b4a027a48c31716a9546195619bf8856c6527f (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
#! /bin/sh

# The prefix is normally filled by make install. If
# installing by hand, fill it in yourself!
NAME=sslh
PREFIX=/usr
DAEMON=$PREFIX/bin/${NAME}
CONFIG=/etc/sslh/sslh.conf

start()
{
        pid=`pidof -o %PPID sslh`
        if [[ -z $pid ]]; then
            echo "Start services: sslh"
        $DAEMON -F ${CONFIG}
            logger -t ${tag} -p ${facility} -i 'Started sslh'
        else
            echo "Service is running."
        fi
}

stop()
{
        echo "Stop services: sslh"
        killall -9 ${NAME}
        logger -t ${tag} -p ${facility} -i 'Stopped sslh'
}


case "$1" in
	  start)
		    start
		    ;;
	  stop)
		    stop
		    ;;
    restart)
		    stop
		    sleep 5
		    start
		    ;;
	  *)
		    echo "Usage: /etc/rc.d/rc.sslh {start|stop|restart}" >&2
		    ;;
esac

exit 0