Commit
9c6ee9d1ecd85535c was incomplete - while it will run openvpn with
sudo, it will not use sudo for the "kill" commands needed to test whether
the background process is still there, and for actually stopping openvpn
after the test has finished.
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
opid=$!
# make sure openvpn client is terminated in case shell exits
- trap "kill $opid" 0
- trap "kill $opid ; trap - 0 ; exit 1" 1 2 3 15
+ trap "$RUN_SUDO kill $opid" 0
+ trap "$RUN_SUDO kill $opid ; trap - 0 ; exit 1" 1 2 3 15
echo "wait for connection to establish..."
sleep 10
# test whether OpenVPN process is still there
- if kill -0 $opid
+ if $RUN_SUDO kill -0 $opid
then :
else
echo -e "OpenVPN process has failed to start up, check log ($LOGDIR/$SUF:openvpn.log). FAIL.\ntail of logfile follows:\n..." >&2
echo -e "ping tests done.\n"
echo "stopping OpenVPN"
- kill $opid
+ $RUN_SUDO kill $opid
wait $!
rc=$?
if [ $rc != 0 ] ; then