mirror of
https://github.com/moparisthebest/sslh
synced 2024-11-24 18:12:17 -05:00
5ae9ba184c
This is an update of the init scripts originally written by Andre Krajnik. It is quite similar to other init scripts brought by common packages in RH/CentOS. This commit also introduces a pretty straight forward sysconfig file.
76 lines
1.7 KiB
Bash
Executable File
76 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# sslh Startup script for the SSL/SSH multiplexer
|
|
#
|
|
# chkconfig: - 13 87
|
|
# description: Sslh accepts connections on specified ports, and forwards
|
|
# them further based on tests performed on the first data
|
|
# packet sent by the remote client.
|
|
# processname: sslh
|
|
# config: /etc/sslh.cfg
|
|
# config: /etc/sysconfig/sslh
|
|
# pidfile: /var/run/sslh/sslh.pid
|
|
#
|
|
# Authors:
|
|
# Andre Krajnik akrajnik@gmail.com - 2010-03-20
|
|
# Julien Thomas julthomas@free.fr - 2013-08-25
|
|
|
|
# Source function library.
|
|
. /etc/init.d/functions
|
|
|
|
if [ -f /etc/sysconfig/sslh ]; then
|
|
. /etc/sysconfig/sslh
|
|
fi
|
|
|
|
PROGNAME=sslh
|
|
SSLH=${SSLH:-/usr/sbin/sslh-select}
|
|
SSLH_LANG=${SSLH_LANG:-C}
|
|
CONFIG=${CONFIG:-/etc/sslh.cfg}
|
|
PIDFILE=${PIDFILE:-/var/run/sslh/sslh.pid}
|
|
LOCKFILE=${LOCKFILE:-/var/lock/subsys/sslh}
|
|
STOP_TIMEOUT=${STOP_TIMEOUT:-10}
|
|
RETVAL=0
|
|
|
|
start() {
|
|
echo -n "Starting $PROGNAME: "
|
|
LANG=$SSLH_LANG daemon --pidfile="$PIDFILE" \
|
|
${SSLH_USER:+--user="${SSLH_USER}"} \
|
|
"$SSLH" ${CONFIG:+-F "$CONFIG"} "$OPTIONS"
|
|
RETVAL=$?
|
|
echo
|
|
[ $RETVAL = 0 ] && touch "$LOCKFILE"
|
|
return $RETVAL
|
|
}
|
|
|
|
stop() {
|
|
echo -n "Stopping $PROGNAME: "
|
|
killproc -p "$PIDFILE" -d "$STOP_TIMEOUT" "$SSLH"
|
|
RETVAL=$?
|
|
echo
|
|
[ $RETVAL = 0 ] && rm -f "$LOCKFILE" "$PIDFILE"
|
|
}
|
|
|
|
# See how we were called.
|
|
case "$1" in
|
|
start)
|
|
start
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
status)
|
|
status -p "$PIDFILE" "$SSLH"
|
|
RETVAL=$?
|
|
;;
|
|
restart)
|
|
stop
|
|
start
|
|
;;
|
|
*)
|
|
echo "Usage: $PROGNAME {start|stop|status|restart}"
|
|
RETVAL=2
|
|
;;
|
|
esac
|
|
|
|
exit $RETVAL
|