Skip to contentSkip to conversation

Init script/Debian for OpenVPN

Openvpn-devel Николай Афанасьев 2 participants 2 messages Dec 2, 2004 – Dec 3, 2004

lore
Share & tools
lore
#0 lore raw

Hello, OpenVPN developers!

I was advised to send you this shell, and I hope this can be helpful

Afanasyev Nikolay
[email protected]...

Quoted 10 lines

-----Original Message-----
From: James Yonan [mailto:[email protected]...]
Sent: Thursday, December 02, 2004 7:21 PM
To: Николай Афанасьев
Subject: Re: Init script/Debian for OpenVPN

Thanks for your contribution.

It would be best if you send it to [email protected]

Quoted 12 lines

Thanks,
James

Quoted 2 lines · On Thu, 2 Dec 2004, [koi8-r] Николай Афанасьев wrote:

Hello, James
Can I contribute a little to your project? I have init

script for Debian GNU Linux that I wrote for OpenVPN:

Quoted 4 lines

PS: sorry bout permissions 8-)

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Start openvpn.sh >>>>>>>>>>>>>>>>>>

#!/bin/sh

DAEMON="/usr/local/sbin/openvpn"
piddir="/var/run/openvpn"
work=/etc/openvpn
export LANG=C
export PATH

test -f $DAEMON || exit 0

case "$1" in
start)

    cd $work
    # Start every .conf in $work and run .sh if exists
    for c in `/bin/ls *.conf 2>/dev/null`; do
      bn=${c%%.conf}
      echo -n "Starting OpenVPN whith config $c"
      args="--daemon --writepid $piddir/$bn.pid --config $c --cd $work"
      start-stop-daemon --start --pidfile $piddir/$bn.pid --exec $DAEMON -- $args
      if [ $? == 0 ]; then 
       echo " [OK]" 
      else 
       echo " [failed]" 
      fi 
    done
    ;;

stop)

    for pidf in `/bin/ls $piddir/*.pid 2>/dev/null`; do
      if [ -s $pidf ]; then
        echo -n  "Shuttin' down OpenVPN whith PID file $pidf"
        start-stop-daemon --stop --pidfile $pidf --oknodo --exec $DAEMON  
        if [ $? == 0 ]; then 
	  echo " [OK]" 
	else 
	  echo " [failed]" 
	fi
	rm -f $pidf
      fi
    done
    ;;

reload)

    for pidf in `/bin/ls $piddir/*.pid 2>/dev/null`; do
      if [ -s $pidf ]; then
        echo -n "Reload OpenVPN whith PID file $pidf"
        start-stop-daemon --stop --pidfile $pidf --signal USR1 --exec $DAEMON  
	if [ $? == 0 ]; then 
	  echo " [OK]" 
	else 
	  echo " [failed]" 
	fi
      fi
    done
    ;;

restart)

    $0 stop
    $0 start
    exit $?
    ;;

*)
echo "Usage: $0 {start|stop|reload|restart}"
exit 1
;;
esac

if [ $? == 0 ]; then
exit 0
else
exit 1
fi

Quoted 12 lines
Quoted 9 lines

<<<<<<<<<<<< End openvpn.sh <<<<<<<<<<<<<<<<<<

Afanasyev Nikolay
[email protected]...

#1 lore raw

The Debian package has already a init.d script. Did you take a look at it?
Yours doesn't improve it in any visible way, so, what's the point? Please take a look at the debian package (use backports.org if you're using Debian woody) and feel free to send me improvements.

Regards,

Alberto

Quoted 131 lines · ??????? ?????????

Hello, OpenVPN developers!

I was advised to send you this shell, and I hope this can be helpful

Afanasyev Nikolay
[email protected]...

Quoted 10 lines

-----Original Message-----
From: James Yonan [mailto:[email protected]...]
Sent: Thursday, December 02, 2004 7:21 PM
To: ??????? ?????????
Subject: Re: Init script/Debian for OpenVPN

Thanks for your contribution.

It would be best if you send it to [email protected]

Quoted 12 lines

Thanks,
James

Quoted 2 lines · On Thu, 2 Dec 2004, [koi8-r] ??????? ????????? wrote:

Hello, James
Can I contribute a little to your project? I have init

script for Debian GNU Linux that I wrote for OpenVPN:

Quoted 4 lines

PS: sorry bout permissions 8-)

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Start openvpn.sh >>>>>>>>>>>>>>>>>>

#!/bin/sh

DAEMON="/usr/local/sbin/openvpn"
piddir="/var/run/openvpn"
work=/etc/openvpn
export LANG=C
export PATH

test -f $DAEMON || exit 0

case "$1" in
start)

    cd $work
    # Start every .conf in $work and run .sh if exists
    for c in `/bin/ls *.conf 2>/dev/null`; do
      bn=${c%%.conf}
      echo -n "Starting OpenVPN whith config $c"
      args="--daemon --writepid $piddir/$bn.pid --config $c --cd $work"
      start-stop-daemon --start --pidfile $piddir/$bn.pid --exec $DAEMON -- $args
      if [ $? == 0 ]; then 
       echo " [OK]" 
      else 
       echo " [failed]" 
      fi 
    done
    ;;

stop)

    for pidf in `/bin/ls $piddir/*.pid 2>/dev/null`; do
      if [ -s $pidf ]; then
        echo -n  "Shuttin' down OpenVPN whith PID file $pidf"
        start-stop-daemon --stop --pidfile $pidf --oknodo --exec $DAEMON  
        if [ $? == 0 ]; then 
	  echo " [OK]" 
	else 
	  echo " [failed]" 
	fi
	rm -f $pidf
      fi
    done
    ;;

reload)

    for pidf in `/bin/ls $piddir/*.pid 2>/dev/null`; do
      if [ -s $pidf ]; then
        echo -n "Reload OpenVPN whith PID file $pidf"
        start-stop-daemon --stop --pidfile $pidf --signal USR1 --exec $DAEMON  
	if [ $? == 0 ]; then 
	  echo " [OK]" 
	else 
	  echo " [failed]" 
	fi
      fi
    done
    ;;

restart)

    $0 stop
    $0 start
    exit $?
    ;;

*)
echo "Usage: $0 {start|stop|reload|restart}"
exit 1
;;
esac

if [ $? == 0 ]; then
exit 0
else
exit 1
fi

Quoted 5 lines
Quoted 5 lines

<<<<<<<<<<<< End openvpn.sh <<<<<<<<<<<<<<<<<<

Quoted 7 lines
Quoted 4 lines

Afanasyev Nikolay
[email protected]...

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Signature · 5 lines
Alberto Gonzalez Iniesta    | Formación, consultoría y soporte técnico
agi@(inittab.org|debian.org)| en GNU/Linux y software libre
Encrypted mail preferred    | http://inittab.org

Key fingerprint = 9782 04E7 2B75 405C F5E9  0C81 C514 AF8E 4BA4 01C3