Files: 48164c4d7780fed222c1f94e2ede506d21b5984c / scripts / etc.rc.d.init.d.sslh.centos
1709 bytesRaw
1 | #!/bin/bash |
2 | # |
3 | # sslh Startup script for the SSL/SSH multiplexer |
4 | # |
5 | # chkconfig: - 13 87 |
6 | # description: Sslh accepts connections on specified ports, and forwards |
7 | # them further based on tests performed on the first data |
8 | # packet sent by the remote client. |
9 | # processname: sslh |
10 | # config: /etc/sslh.cfg |
11 | # config: /etc/sysconfig/sslh |
12 | # pidfile: /var/run/sslh/sslh.pid |
13 | # |
14 | # Authors: |
15 | # Andre Krajnik akrajnik@gmail.com - 2010-03-20 |
16 | # Julien Thomas julthomas@free.fr - 2013-08-25 |
17 | |
18 | # Source function library. |
19 | . /etc/init.d/functions |
20 | |
21 | if [ -f /etc/sysconfig/sslh ]; then |
22 | . /etc/sysconfig/sslh |
23 | fi |
24 | |
25 | PROGNAME=sslh |
26 | SSLH=${SSLH:-/usr/sbin/sslh-select} |
27 | SSLH_LANG=${SSLH_LANG:-C} |
28 | CONFIG=${CONFIG:-/etc/sslh.cfg} |
29 | PIDFILE=${PIDFILE:-/var/run/sslh/sslh.pid} |
30 | LOCKFILE=${LOCKFILE:-/var/lock/subsys/sslh} |
31 | STOP_TIMEOUT=${STOP_TIMEOUT:-10} |
32 | RETVAL=0 |
33 | |
34 | start() { |
35 | echo -n "Starting $PROGNAME: " |
36 | LANG=$SSLH_LANG daemon --pidfile="$PIDFILE" \ |
37 | ${SSLH_USER:+--user="${SSLH_USER}"} \ |
38 | "$SSLH" ${CONFIG:+-F "$CONFIG"} "$OPTIONS" |
39 | RETVAL=$? |
40 | echo |
41 | [ $RETVAL = 0 ] && touch "$LOCKFILE" |
42 | return $RETVAL |
43 | } |
44 | |
45 | stop() { |
46 | echo -n "Stopping $PROGNAME: " |
47 | killproc -p "$PIDFILE" -d "$STOP_TIMEOUT" "$SSLH" |
48 | RETVAL=$? |
49 | echo |
50 | [ $RETVAL = 0 ] && rm -f "$LOCKFILE" "$PIDFILE" |
51 | } |
52 | |
53 | # See how we were called. |
54 | case "$1" in |
55 | start) |
56 | start |
57 | ;; |
58 | stop) |
59 | stop |
60 | ;; |
61 | status) |
62 | status -p "$PIDFILE" "$SSLH" |
63 | RETVAL=$? |
64 | ;; |
65 | restart) |
66 | stop |
67 | start |
68 | ;; |
69 | *) |
70 | echo "Usage: $PROGNAME {start|stop|status|restart}" |
71 | RETVAL=2 |
72 | ;; |
73 | esac |
74 | |
75 | exit $RETVAL |
76 |
Built with git-ssb-web