I just wrote a simple rc.d/init.d script for OpenVPN. It's a rip off
of /etc/rc.d/sshd but it works for me! It would be nice if it were
included in the openvpn package.

---------------------


#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

CONFIG="/etc/openvpn/config.conf"
DESCRIPTION="OpenVPN"
DAEMON="openvpn"
EXEC="/usr/sbin/openvpn"
PID=`cat /var/run/$DAEMON.pid 2>/dev/null`

case "$1" in
  start)
    stat_busy "Starting $DESCRIPTION"
    [ -z "$PID" ] && $EXEC --config $CONFIG > /dev/null 2>&1 &
    if [ $? -gt 0 ]; then
      stat_fail
    else
      add_daemon $DAEMON
      echo `pidof openvpn` > /var/run/$DAEMON.pid
      stat_done
    fi
    ;;
  stop)
    stat_busy "Stopping $DESCRIPTION"
    [ ! -z "$PID" ]  && kill $PID &> /dev/null && rm /var/run/$DAEMON.pid
    if [ $? -gt 0 ]; then
      stat_fail
    else
      rm_daemon sshd
      stat_done
    fi
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"
esac
exit 0

_______________________________________________
arch mailing list
[email protected]
http://archlinux.org/mailman/listinfo/arch

Reply via email to