Skip to content

Commit

Permalink
Update app/openvpn.sh with better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Fullaxx committed Mar 26, 2019
1 parent 9914b12 commit 5c82428
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/openvpn.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/bash

bail()
{
echo "$1"
exit 1
}

OVPNSLEEPTIME=${OVPNSLEEPTIME:-5}

# https://www.cyberciti.biz/faq/bash-shell-check-for-any-mp3-files-in-directory/
Expand All @@ -8,7 +14,8 @@ OVPNSLEEPTIME=${OVPNSLEEPTIME:-5}
#shopt -u nullglob

if [ x"${OVPNCFG}" != "x" ]; then
if [ ! -r /rtorrent/config/${OVPNCFG} ]; then bail "/rtorrent/config/${OVPNCFG} not available!"; fi
openvpn --config /rtorrent/config/${OVPNCFG} --daemon \
--script-security 2 --up /app/up.sh --down /app/down.sh || exit 1
--script-security 2 --up /app/up.sh --down /app/down.sh
sleep ${OVPNSLEEPTIME}
fi

0 comments on commit 5c82428

Please sign in to comment.