diff options
author | Nicolas Reynolds <fauno@kiwwwi.com.ar> | 2011-08-15 11:25:44 -0300 |
---|---|---|
committer | Nicolas Reynolds <fauno@kiwwwi.com.ar> | 2011-08-15 11:25:44 -0300 |
commit | d3a18c96784861f4671d9575d71cb96041bc4fab (patch) | |
tree | 27e73dccc79fb400f2bd2a855fd523dd8e704db8 /testing/openvpn/openvpn.rc | |
parent | 1b8314826a584ddba121a6cb764efd44c784c53e (diff) | |
parent | 4784cc8068c68b6fc23c2bd0ee8158b2a924f5f4 (diff) |
Merge branch 'master' of ssh://vparabola/home/parabola/abslibre-pre-mips64el
Conflicts:
community/dopewars/PKGBUILD
community/flightgear/PKGBUILD
extra/bmp/PKGBUILD
extra/qemu/PKGBUILD
extra/sbcl/PKGBUILD
Diffstat (limited to 'testing/openvpn/openvpn.rc')
-rwxr-xr-x | testing/openvpn/openvpn.rc | 43 |
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 |