This resolves an issue where $! returns the PID of the sudo process instead of the PID of OpenVPN and when sudo does not properly propagate signales down to OpenVPN.
Trac: #738 Signed-off-by: David Sommerseth <dav...@openvpn.net> --- tests/t_client.sh.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/t_client.sh.in b/tests/t_client.sh.in index 62d6730..fc82cdb 100755 --- a/tests/t_client.sh.in +++ b/tests/t_client.sh.in @@ -263,10 +263,14 @@ do continue fi + pidfile="${top_builddir}/tests/$LOGDIR/openvpn-$SUF.pid" + openvpn_conf="$openvpn_conf --writepid $pidfile" echo " run openvpn $openvpn_conf" echo "# src/openvpn/openvpn $openvpn_conf" >$LOGDIR/$SUF:openvpn.log $RUN_SUDO "${top_builddir}/src/openvpn/openvpn" $openvpn_conf >>$LOGDIR/$SUF:openvpn.log & - opid=$! + sleep 3 # Wait for OpenVPN to initialize and have had time to write the pid file + opid=`cat $pidfile` + echo " OpenVPN running with PID $opid" # make sure openvpn client is terminated in case shell exits trap "$RUN_SUDO kill $opid" 0 -- 1.8.3.1 ------------------------------------------------------------------------------ _______________________________________________ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel