4 ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
5 ## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
10 # Required-Start: $local_fs $remote_fs
11 # Required-Stop: $local_fs $remote_fs
12 # Should-Start: $syslog
13 # Should-Stop: $syslog
14 # Default-Start: 2 3 4 5
16 # Short-Description: Start or stop stunnel 4.x (SSL tunnel for network daemons)
19 DEFAULTPIDFILE="/var/run/stunnel4.pid"
20 DAEMON=/usr/bin/stunnel4
28 if [ -n "${2:-}" ]; then
29 if [ -e "/etc/stunnel/$2.conf" ]; then
30 FILES="/etc/stunnel/$2.conf"
32 echo >&2 "/etc/stunnel/$2.conf does not exist."
36 FILES="/etc/stunnel/*.conf"
41 if test -f $file; then
42 CHROOT=`grep "^chroot" $file|sed "s;.*= *;;"`
43 PIDFILE=`grep "^pid" $file|sed "s;.*= *;;"`
44 if [ "$PIDFILE" = "" ]; then
45 PIDFILE=$DEFAULTPIDFILE
47 if test -f $CHROOT/$PIDFILE; then
54 if ! [ -d /var/run/stunnel4 ]; then
55 rm -rf /var/run/stunnel4
56 install -d -o stunnel4 -g stunnel4 /var/run/stunnel4
58 for file in $FILES; do
59 if test -f $file; then
61 PROCLIST=`get_pids $file`
62 if [ "$PROCLIST" ] && kill -0 $PROCLIST 2>/dev/null; then
63 echo -n "[Already running: $file] "
64 elif $DAEMON $ARGS; then
65 echo -n "[Started: $file] "
67 echo "[Failed: $file]"
68 echo "You should check that you have specified the pid= in you configuration file"
77 for file in $FILES; do
78 PROCLIST=`get_pids $file`
79 if [ "$PROCLIST" ] && kill -0 $PROCLIST 2>/dev/null; then
81 echo -n "[stopped: $file] "
86 if [ "x$OPTIONS" != "x" ]; then
90 test -f /etc/default/stunnel4 && . /etc/default/stunnel4
91 if [ "$ENABLED" = "0" ] ; then
92 echo "$DESC disabled, see /etc/default/stunnel4"
96 test -x $DAEMON || exit 0
102 echo -n "Starting $DESC: "
107 echo -n "Stopping $DESC: "
111 #force-reload does not send a SIGHUP, since SIGHUP is interpreted as a
112 #quit signal by stunnel. I reported this problem to upstream authors.
113 force-reload|restart)
114 echo -n "Restarting $DESC: "
122 echo "Usage: $N {start|stop|force-reload|restart} [<stunnel instance>]" >&2