From: Gert Doering Date: Fri, 3 Feb 2012 17:18:07 +0000 (+0200) Subject: Fix RUN_SUDO functionality for t_client.sh X-Git-Tag: v2.3-alpha1~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc3ee19dee6c66e2325a24e864b5328128404e83;p=thirdparty%2Fopenvpn.git Fix RUN_SUDO functionality for t_client.sh 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 Acked-by: David Sommerseth Signed-off-by: David Sommerseth --- diff --git a/t_client.sh.in b/t_client.sh.in index a6377dba0..47839deef 100755 --- a/t_client.sh.in +++ b/t_client.sh.in @@ -233,14 +233,14 @@ do 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 @@ -271,7 +271,7 @@ do echo -e "ping tests done.\n" echo "stopping OpenVPN" - kill $opid + $RUN_SUDO kill $opid wait $! rc=$? if [ $rc != 0 ] ; then