#!/bin/sh # # stunnel stunnel (Universal SSL tunnel) # # chkconfig: 345 14 91 # # description: stunnel (Universal SSL tunnel) # # id: $Id$ # # Source function library . /etc/rc.d/init.d/functions # Get network config . /etc/sysconfig/network # Get service config [ -f /etc/sysconfig/stunnel ] && . /etc/sysconfig/stunnel # Check that networking is up. if is_no "${NETWORKING}"; then msg_network_down stunnel exit 1 fi # Daemon doesn't die if config doesn't exist if [ ! -f $STUNNEL_CONFIG ]; then echo "Stunnel config $STUNNEL_CONFIG does not exist." exit 1 fi # See how we were called. case "$1" in start) # Check if the service is already running? if [ ! -f /var/lock/subsys/stunnel ]; then msg_starting stunnel; busy daemon stunnel $STUNNEL_CONFIG RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/stunnel else msg_already_running stunnel exit 1 fi ;; stop) if [ -f /var/lock/subsys/stunnel ]; then msg_stopping stunnel killproc stunnel rm -f /var/run/stunnel/stunnel.pid /var/lock/subsys/stunnel >/dev/null 2>&1 else msg_not_running stunnel exit 1 fi ;; restart) $0 stop $0 start ;; status) status stunnel exit $? ;; *) msg_usage "$0 {start|stop|status|restart}" exit 1 esac exit $RETVAL