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]})
|
thepid=$(cat ${pidfile[$x]})
|
||||||
if [[ -n $thepid ]]; then
|
if [[ -n $thepid ]]; then
|
||||||
sudo kill $thepid
|
sudo kill $thepid
|
||||||
sleep 2 # give it some time
|
wait $thepid # wait for the process to end
|
||||||
res=$(ps -p $thepid 2>&1)
|
if [[ $? -eq 0 ]]; then
|
||||||
if [[ $? -ne 0 ]]; then
|
|
||||||
rm -f "${pidfile[$x]}"
|
rm -f "${pidfile[$x]}"
|
||||||
rv=0
|
rv=0
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue