slackbuilds_ponce/network/sslh/rc.sslh
mara 6c1611b144 network/sslh: Updated for version 1.18.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2016-09-04 23:55:53 +07:00

53 lines
814 B
Bash

#!/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