mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-29 13:00:32 +01:00
6c1611b144
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
53 lines
814 B
Bash
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
|