Improve waiting for vpn process to end
This commit is contained in:
parent
69fa9f3637
commit
6feae08810
5
cvpn
5
cvpn
|
@ -433,9 +433,8 @@ elif [[ $cmd == "off" ]]; then
|
|||
thepid=$(cat ${pidfile[$x]})
|
||||
if [[ -n $thepid ]]; then
|
||||
sudo kill $thepid
|
||||
sleep 2 # give it some time
|
||||
res=$(ps -p $thepid 2>&1)
|
||||
if [[ $? -ne 0 ]]; then
|
||||
wait $thepid # wait for the process to end
|
||||
if [[ $? -eq 0 ]]; then
|
||||
rm -f "${pidfile[$x]}"
|
||||
rv=0
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue