Add a config parameter: change the status folder

This commit is contained in:
Edouard DUPIN 2019-03-30 13:35:32 +01:00
parent 79717903fa
commit dbab08e92a

View File

@ -104,6 +104,7 @@ usage() {
echo " -t Use TAP device (instead of TUN device)"
echo " -T Encrypt packets with the given cipher algorithm instead of the default one (tls-cipher)."
echo " -z Enable comp-lzo compression."
echo " -S Change status folder. Default '/tmp'"
}
process_route_config() {
@ -167,12 +168,13 @@ OVPN_ROUTES=()
OVPN_SERVER=192.168.255.0/24
OVPN_SERVER_URL=''
OVPN_TLS_CIPHER=''
OVPN_STATUS_PATH='/tmp'
# Import existing configuration if present
[ -r "$OVPN_ENV" ] && source "$OVPN_ENV"
# Parse arguments
while getopts ":a:e:E:C:T:r:s:du:bcp:n:k:DNm:f:tz2" opt; do
while getopts ":a:e:E:C:T:r:s:du:bcp:n:k:DNm:f:tz2S:" opt; do
case $opt in
a)
OVPN_AUTH="$OPTARG"
@ -253,6 +255,9 @@ while getopts ":a:e:E:C:T:r:s:du:bcp:n:k:DNm:f:tz2" opt; do
f)
OVPN_FRAGMENT="$OPTARG"
;;
S)
OVPN_STATUS_PATH="$OPTARG"
;;
\?)
set +x
echo "Invalid option: -$OPTARG" >&2
@ -334,7 +339,7 @@ proto $OVPN_PROTO
# Rely on Docker to do port mapping, internally always 1194
port 1194
dev $OVPN_DEVICE$OVPN_DEVICEN
status /tmp/openvpn-status.log
status $OVPN_STATUS_PATH/openvpn-status.log
user nobody
group nogroup