#!/bin/sh # # httptunnel httptunnel short service description # # chkconfig: 345 90 36 # processname: hts # config: /etc/sysconfig/httptunnel # # description: httptunnel long service description # Copyright (c) by Davide Madrisan # Source function library . /etc/rc.d/init.d/functions # Get network config . /etc/sysconfig/network RETVAL=0 case "$1" in start) [ "$NETWORKING" = yes ] || exit 1 if [ ! -f /var/lock/subsys/httptunnel ]; then echo -n "Starting httptunnel: " awk '/^[^!#].*/ { print $0; }' \ < /etc/sysconfig/httptunnel | \ while read LISTEN_PORT FWD_HOST_PORT; do echo $LISTEN_PORT $FWD_HOST_PORT daemon hts -F "$FWD_HOST_PORT" "$LISTEN_PORT" done RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/httptunnel echo else echo "Service httptunnel already running" fi ;; stop) if [ -f /var/lock/subsys/httptunnel ]; then echo -n "Stopping httptunnel: " killproc hts echo rm -f /var/lock/subsys/httptunnel else # show "%s service is not running." httptunnel echo "httptunnel service is not running." fi ;; restart|force-reload) $0 stop $0 start exit $? ;; status) status httptunnel exit $? ;; *) # show "Usage: %s {start|stop|restart|force-reload|status}" $0 echo $"Usage:"" $0 {start|stop|restart|force-reload|status}" exit 1 esac exit $RETVAL # This must be last line ! # vi:syntax=sh:tw=78:ts=8:sw=4