#!/bin/bash # rebuild : build $config file with /etc/nagios/modules/ . `dirname $0`/functions option config standard_option /etc/openvpn/openvpn.conf option pidfile reserved_option /var/run/openvpn.pid option remote multiple_option option proto standard_option option port standard_option option ca standard_option option cert standard_option option key standard_option option dev standard_option option status standard_option /var/state/openvpn.status option bin reserved_option /usr/sbin/openvpn option cmdline reserved_option 'openvpn --config $opt_config --writepid $pidfile ${opt_remote[@]:+${opt_remote[@]//#/--remote }} ${opt_proto:+--proto $opt_proto} ${opt_port:+--port $opt_port} ${opt_ca:+--ca $opt_ca} ${opt_cert:+--cert $opt_cert} ${opt_key:+--key $opt_key} ${opt_status:+--status $opt_status} ${opt_dev:+--dev $opt_dev}' # perform a forced synchronisation before starting the daemon function fct_pre_start { [ ! -d /dev/net ] && mkdir /dev/net [ ! -c /dev/net/tun ] && rm -f /dev/net/tun && mknod /dev/net/tun c 10 200 grep -qs "^200 net/tun$" /proc/misc || modprobe tun } load_config