aboutsummaryrefslogtreecommitdiff
path: root/gentoo/openvpn.init
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2008-05-12 20:31:43 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2008-05-12 20:31:43 +0000
commit1bda73a7b0f45a2502ae93e33e30b98152d893f3 (patch)
tree7bdf8f59ec2c6443a071a0217f78f8a999596030 /gentoo/openvpn.init
parentMisc XGUI fixes. (diff)
downloadopenvpn-1bda73a7b0f45a2502ae93e33e30b98152d893f3.tar.xz
Moved branch into official BETA21 position.
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@2959 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'gentoo/openvpn.init')
-rwxr-xr-xgentoo/openvpn.init111
1 files changed, 0 insertions, 111 deletions
diff --git a/gentoo/openvpn.init b/gentoo/openvpn.init
deleted file mode 100755
index 99fa8b2..0000000
--- a/gentoo/openvpn.init
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/sbin/runscript
-
-# OpenVPN start/stop script
-# Adapted to Gentoo by James Yonan
-
-# Originally Contributed to the OpenVPN project by
-# Douglas Keller <doug@voidstar.dyndns.org>
-# 2002.05.15
-
-# This script does the following:
-#
-# - Starts an openvpn process for each .conf file it finds in
-# /etc/openvpn.
-#
-# - If /etc/openvpn/xxx.sh exists for a xxx.conf file then it executes
-# it before starting openvpn (useful for doing openvpn --mktun...).
-
-# - In addition to start/stop you can do:
-#
-# service openvpn reload - SIGHUP
-# service openvpn reopen - SIGUSR1
-# service openvpn status - SIGUSR2
-
-# Location of openvpn binary
-openvpn=/usr/local/sbin/openvpn
-
-# PID directory
-piddir=/var/run/openvpn
-
-# Our working directory (.conf files should be here)
-work=/etc/openvpn
-
-# Our options
-opts="start stop restart condrestart"
-
-depend() {
- need net
- use dns
-}
-
-start() {
- ebegin "Starting OpenVPN"
-
- # Load the TUN/TAP module
- /sbin/modprobe tun >/dev/null 2>&1
-
- if [ ! -d $piddir ]; then
- mkdir $piddir
- fi
-
- cd $work
-
- # Start every .conf in $work and run .sh if exists
- local errors=0
- local successes=0
- local retstatus=0
- for c in `/bin/ls *.conf 2>/dev/null`; do
- bn=${c%%.conf}
- if [ -f "$bn.sh" ]; then
- . $bn.sh
- fi
- rm -f $piddir/$bn.pid
- $openvpn --daemon openvpn-$bn --writepid $piddir/$bn.pid --config $c --cd $work
- if [ $? = 0 ]; then
- successes=1
- else
- errors=1
- fi
- done
-
- # Decide status based on errors/successes.
- # If at least one tunnel succeeded, we return success.
- # If some tunnels succeeded and some failed, we return
- # success but give a warning.
- if [ $successes = 1 ]; then
- if [ $errors = 1 ]; then
- ewarn "Note: At least one OpenVPN tunnel failed to start"
- fi
- else
- retstatus=1
- if [ $errors = 0 ]; then
- ewarn "Note: No OpenVPN configuration files were found in $work"
- fi
- fi
- eend $retstatus "Error starting OpenVPN"
-}
-
-stop() {
- ebegin "Stopping OpenVPN"
- for pidf in `/bin/ls $piddir/*.pid 2>/dev/null`; do
- if [ -s $pidf ]; then
- kill `cat $pidf` >/dev/null 2>&1
- fi
- rm -f $pidf
- done
- eend 0
-}
-
-# this should really be in runscript.sh
-started() {
- if [ -L "${svcdir}/started/${myservice}" ]; then
- return 1
- else
- return 0
- fi
-}
-
-# attempt to restart ONLY if we are already started
-condrestart() {
- started || restart
-}