summaryrefslogtreecommitdiff
path: root/testing/openvpn/openvpn.rc
diff options
context:
space:
mode:
authorJoshua Ismael Haase Hernandez <hahj87@gmail.com>2011-05-19 12:44:24 -0500
committerJoshua Ismael Haase Hernandez <hahj87@gmail.com>2011-05-19 12:44:24 -0500
commit071445e6a2bb31ddf638e6f2e5362953b47e72dc (patch)
tree9ec266d72aaa5971dee2d1abbe2de511d971de87 /testing/openvpn/openvpn.rc
parentc14218d562c03601d6d23666f77ed0c2f0025c1b (diff)
parentb8ea4461e461f0e1782e28b5810eb811423afa79 (diff)
Merge branch 'master' of vparabola:~/abslibre-pre-mips64el into pre
Conflicts: core/heimdal/PKGBUILD extra/apache-ant/PKGBUILD extra/aria2/PKGBUILD extra/bs/PKGBUILD extra/dosbox/PKGBUILD extra/ettercap-gtk/PKGBUILD extra/gqmpeg/PKGBUILD extra/gtk-theme-switch2/PKGBUILD extra/icecast/PKGBUILD extra/kmldonkey/PKGBUILD extra/kmplayer/PKGBUILD extra/libbtctl/PKGBUILD extra/libx86/PKGBUILD extra/mc/PKGBUILD extra/monotone/PKGBUILD extra/nbsmtp/PKGBUILD extra/nickle/PKGBUILD extra/nppangband/PKGBUILD extra/numlockx/PKGBUILD extra/python-gtkglext/PKGBUILD extra/speedcrunch/PKGBUILD extra/vbetool/PKGBUILD libre/xchat-gnome-libre/PKGBUILD libre/xchat-gnome-libre/gtk2-2.20.patch libre/xchat-gnome-libre/xchat-gnome-0.26.1-deprecated-symbol.patch libre/xchat-gnome-libre/xchat-gnome.install
Diffstat (limited to 'testing/openvpn/openvpn.rc')
-rwxr-xr-xtesting/openvpn/openvpn.rc43
1 files changed, 43 insertions, 0 deletions
diff --git a/testing/openvpn/openvpn.rc b/testing/openvpn/openvpn.rc
new file mode 100755
index 000000000..96c28b641
--- /dev/null
+++ b/testing/openvpn/openvpn.rc
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+CFGDIR="/etc/openvpn"
+STATEDIR="/var/run/openvpn"
+
+case "$1" in
+ start)
+ stat_busy "Starting OpenVPN ... "
+ success=0
+ mkdir -p "${STATEDIR}"
+ for cfg in "${CFGDIR}"/*.conf; do
+ stat_append "$(basename "${cfg}" .conf) "
+ /usr/sbin/openvpn --daemon --writepid "${STATEDIR}"/"$(basename "${cfg}" .conf)".pid --cd "${CFGDIR}" --config "${cfg}" || success=$?
+ done
+ if [ $success -eq 0 ]; then
+ add_daemon openvpn
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping OpenVPN ..."
+ for pidfile in "${STATEDIR}"/*.pid; do
+ stat_append "$(basename "${pidfile}" .pid) "
+ kill $(cat "${pidfile}" 2>/dev/null) 2>/dev/null
+ rm -f "${pidfile}"
+ done
+ rm_daemon openvpn
+ stat_done
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0