t_client.sh: Make OpenVPN write PID file to avoid various sudo issues
PATCH 1/1 t_client.sh: Make OpenVPN write PID file to avoid various sudo issues
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 <[email protected]...>
--- tests/t_client.sh.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tests/t_client.sh.in +5 -1
@@ -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
Signature · 1 line
1.8.3.1
ACK. Because it make sense and I've been bitten by the bug, too :-)
Your patch has been applied to the following branches
commit e0926ebfe55347843af701216be9598827a1367a (master) commit 057b70f1642336b7eb939f8515de791d515b8d04 (release/2.3)
Author: David Sommerseth Date: Sat Sep 17 12:20:26 2016 +0300
t_client.sh: Make OpenVPN write PID file to avoid various sudo issues
Trac: #738
Signed-off-by: David Sommerseth <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: http://www.mail-archive.com/search?l=mid&[email protected]...
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering