summaryrefslogtreecommitdiff
path: root/network/sslh/rc.sslh
diff options
context:
space:
mode:
authormara <mara@fail.pp.ua>2016-09-04 23:39:34 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2016-09-04 23:55:53 +0700
commit6c1611b14442bde3c72cbc3cdbf1433c5d96d500 (patch)
treea0c59b55c138629737dd98bb0c2baecb24612217 /network/sslh/rc.sslh
parent3228aeefc184fd5f07f4088a60ecb61500716c5d (diff)
downloadslackbuilds-6c1611b14442bde3c72cbc3cdbf1433c5d96d500.tar.gz
network/sslh: Updated for version 1.18.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/sslh/rc.sslh')
-rw-r--r--network/sslh/rc.sslh84
1 files changed, 45 insertions, 39 deletions
diff --git a/network/sslh/rc.sslh b/network/sslh/rc.sslh
index 38b4a027a4..74c95ca56d 100644
--- a/network/sslh/rc.sslh
+++ b/network/sslh/rc.sslh
@@ -1,47 +1,53 @@
-#! /bin/sh
+#!/bin/sh
+#
+# /etc/rc.d/rc.sslh
+#
+# Start/stop/restart the sslh daemon.
+#
-# 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
+NAME="sslh"
+config="/etc/${NAME}/${NAME}.cfg"
+pidfile="/var/run/${NAME}.pid"
-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
+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()
-{
- echo "Stop services: sslh"
- killall -9 ${NAME}
- logger -t ${tag} -p ${facility} -i 'Stopped sslh'
+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)
- stop
- sleep 5
- start
- ;;
- *)
- echo "Usage: /etc/rc.d/rc.sslh {start|stop|restart}" >&2
- ;;
+case $1 in
+'start')
+ start
+ ;;
+'stop')
+ stop
+ ;;
+'restart')
+ restart
+ ;;
+*)
+ echo "Usage $0 {start|stop|restart}"
esac
-
-exit 0