updated on Fri Jan 13 20:02:10 UTC 2012
[aur-mirror.git] / sslh / rc.sslh
blob13ea1f3de3753be0225e876d73da86cb2964f783
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
5 . /etc/conf.d/sslh
7 PID=$(pidof -o %PPID /usr/sbin/sslh)
8 PIDFILE="/var/run/sslh.pid"
10 case "$1" in
11 start)
12 stat_busy "Starting sslh daemon"
14 touch /var/run/sslh.pid
15 chown nobody ${PIDFILE}
17 [[ -z $PID ]] && sslh -p ${LISTEN} --ssh ${SSH} --ssl ${SSL}
18 if [[ $? -gt 0 ]]; then
19 stat_fail
20 exit 1
21 else
22 add_daemon sslh
23 stat_done
27 stop)
28 stat_busy "Stopping sslh daemon"
30 # KILL
31 [[ ! -z $PID ]] && kill $PID &> /dev/null
33 if [[ $? -gt 0 ]]; then
34 stat_fail
35 exit 1
36 else
37 rm ${PIDFILE}
38 rm_daemon sslh
39 stat_done
43 restart)
44 $0 stop
45 sleep 2
46 $0 start
49 status)
50 stat_busy 'Checking sslh status'
51 ck_status sslh
55 echo "usage: $0 {start|stop|restart|status}"
56 esac
58 exit 0