also sprach Alberto Gonzalez Iniesta <[EMAIL PROTECTED]> [2008.06.16.1241 
+0200]:
> The init.d script was modified to use LSB functions in the last upload.
> But that shouldn't break it. Could you run the script with '-x'.

Note that I told openvpn to restart itself on upgrades.

# DEBIAN_SCRIPT_DEBUG=1 dpkg-reconfigure openvpn
[...]
+ invoke-rc.d openvpn start

DAEMON=/usr/sbin/openvpn
+ DAEMON=/usr/sbin/openvpn
DESC="virtual private network daemon"
+ DESC=virtual private network daemon
CONFIG_DIR=/etc/openvpn
+ CONFIG_DIR=/etc/openvpn
test -x $DAEMON || exit 0
+ test -x /usr/sbin/openvpn
test -d $CONFIG_DIR || exit 0
+ test -d /etc/openvpn

# Source defaults file; edit that file to configure this script.
AUTOSTART="all"
+ AUTOSTART=all
STATUSREFRESH=10
+ STATUSREFRESH=10
if test -e /etc/default/openvpn ; then
  . /etc/default/openvpn
fi
+ test -e /etc/default/openvpn
+ . /etc/default/openvpn
# This is the configuration file for /etc/init.d/openvpn

#
# Start only these VPNs automatically via init script.
# Allowed values are "all", "none" or space separated list of
# names of the VPNs. If empty, "all" is assumed.
#
#AUTOSTART="all"
#AUTOSTART="none"
#AUTOSTART="home office"
#
# Refresh interval (in seconds) of default status files
# located in /var/run/openvpn.$NAME.status
# Defaults to 10, 0 disables status file generation
#
#STATUSREFRESH=10
#STATUSREFRESH=0

start_vpn () {
    if grep -q '^[       ]*daemon' $CONFIG_DIR/$NAME.conf ; then
      # daemon already given in config file
      DAEMONARG=
    else
      # need to daemonize
      DAEMONARG="--daemon ovpn-$NAME"
    fi

    if grep -q '^[       ]*status ' $CONFIG_DIR/$NAME.conf ; then
      # status file already given in config file
      STATUSARG=""
    elif test $STATUSREFRESH -eq 0 ; then
      # default status file disabled in /etc/default/openvpn
      STATUSARG=""
    else
      # prepare default status file
      STATUSARG="--status /var/run/openvpn.$NAME.status $STATUSREFRESH"
    fi

    log_progress_msg " $NAME"
    STATUS=0

    # Check to see if it's already started...
    if test -e /var/run/openvpn.$NAME.pid ; then
      log_failure_msg "Already running (PID file exists)"
      STATUS=1
    else
      $DAEMON --writepid /var/run/openvpn.$NAME.pid \
        $DAEMONARG $STATUSARG --cd $CONFIG_DIR \
        --config $CONFIG_DIR/$NAME.conf || STATUS=1
    fi
}
stop_vpn () {
  kill `cat $PIDFILE` || true
  rm -f $PIDFILE
  rm -f /var/run/openvpn.$NAME.status 2> /dev/null
}

case "$1" in
start)
  log_daemon_msg "Starting $DESC."

  # autostart VPNs
  if test -z "$2" ; then
    # check if automatic startup is disabled by AUTOSTART=none
    if test "x$AUTOSTART" = "xnone" -o -z "$AUTOSTART" ; then
      log_failure_msg " Autostart disabled."
      exit 0
    fi
    if test -z "$AUTOSTART" -o "x$AUTOSTART" = "xall" ; then
      # all VPNs shall be started automatically
      for CONFIG in `cd $CONFIG_DIR; ls *.conf 2> /dev/null`; do
        NAME=${CONFIG%%.conf}
        start_vpn
      done
    else
      # start only specified VPNs
      for NAME in $AUTOSTART ; do
        if test -e $CONFIG_DIR/$NAME.conf ; then
          start_vpn
        else
          log_failure_msg "No such VPN: $NAME"
          STATUS=1
        fi
      done
    fi
  #start VPNs from command line
  else
    while shift ; do
      [ -z "$1" ] && break
      if test -e $CONFIG_DIR/$1.conf ; then
        NAME=$1
        start_vpn
      else
       log_failure_msg " No such VPN: $1"
       STATUS=1
      fi
    done
  fi
  log_end_msg $STATUS

  ;;
stop)
  log_daemon_msg "Stopping $DESC."

  if test -z "$2" ; then
    for PIDFILE in `ls /var/run/openvpn.*.pid 2> /dev/null`; do
      NAME=`echo $PIDFILE | cut -c18-`
      NAME=${NAME%%.pid}
      stop_vpn
      log_progress_msg " $NAME"
    done
  else
    while shift ; do
      [ -z "$1" ] && break
      if test -e /var/run/openvpn.$1.pid ; then
        PIDFILE=`ls /var/run/openvpn.$1.pid 2> /dev/null`
        NAME=`echo $PIDFILE | cut -c18-`
        NAME=${NAME%%.pid}
        stop_vpn
        log_progress_msg " $NAME"
      else
        log_failure_msg " (failure: No such VPN is running: $1)"
      fi
    done
  fi
  log_end_msg 0
  ;;
# We only 'reload' for running VPNs. New ones will only start with 'start' or 
'restart'.
reload|force-reload)
 log_daemon_msg "Reloading $DESC."
  for PIDFILE in `ls /var/run/openvpn.*.pid 2> /dev/null`; do
    NAME=`echo $PIDFILE | cut -c18-`
    NAME=${NAME%%.pid}
# If openvpn if running under a different user than root we'll need to restart
    if egrep '^[[:blank:]]*user[[:blank:]]' $CONFIG_DIR/$NAME.conf > /dev/null 
2>&1 ; then
      stop_vpn
      sleep 1
      start_vpn
      log_progress_msg "(restarted)"
    else
      kill -HUP `cat $PIDFILE` || true
    log_progress_msg " $NAME"
    fi
  done
  log_end_msg 0
  ;;

restart)
  shift
  $0 stop [EMAIL PROTECTED]
  sleep 1
  $0 start [EMAIL PROTECTED]
  ;;
cond-restart)
  log_daemon_msg "Restarting $DESC."
  for PIDFILE in `ls /var/run/openvpn.*.pid 2> /dev/null`; do
    NAME=`echo $PIDFILE | cut -c18-`
    NAME=${NAME%%.pid}
    stop_vpn
    sleep 1
    start_vpn
  done
  log_end_msg 0
  ;;
*)
  echo "Usage: $0 {start|stop|reload|restart|force-reload|cond-restart}" >&2
  exit 1
  ;;
esac
+ log_daemon_msg Starting virtual private network daemon.
+ [ -z Starting virtual private network daemon. ]
+ [ -z  ]
+ echo -n Starting virtual private network daemon.:
Starting virtual private network daemon.:+ return
+ test -z 
+ test xall = xnone -o -z all
+ test -z all -o xall = xall
+ cd /etc/openvpn
+ ls *.conf
+ log_end_msg
+ [ -z  ]
+ return 1
invoke-rc.d: initscript openvpn, action "start" failed.

-- 
 .''`.   martin f. krafft <[EMAIL PROTECTED]>
: :'  :  proud Debian developer, author, administrator, and user
`. `'`   http://people.debian.org/~madduck - http://debiansystem.info
  `-  Debian - when you have better things to do than fixing systems
 
"the only difference between the saint and the sinner
 is that every saint has a past and every sinner has a future."
                                                        -- oscar wilde

Attachment: digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/)

Reply via email to