How to continue bash script execution after openvpn is launched?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
so I have this bash script right here. Basically, it connects my machine to a server and download files from the server and store them in the /tmp directory. The problem is that the bash script stops at the openvpn command and doesn't read what's next, even if the openvpn is in background. Any help please?
Sites=`ls`
for site in $Sites
do
((i=0))
cd $site/vpn
address="$(grep "172" info-$site.txt | cut -c 5-17)"
echo "IP: $address"
ret="$(route | grep "172.16" | cut -c 1-10)"
echo 'password_1' | sudo -S openvpn --config $site.ovpn --auth-user-pass $1$2/$site/vpn/login-$site.txt &
while [ X"$ret" = X"" -o "$i" -le 10 ]; do
echo "toto while"
ret="$(route | grep "172.16" | cut -c 1-10)"
sleep 1
let "i=i+1"
done
sshpass -p 'password2' scp root@"$address":/usr/envitech/DataReports/* /tmp;
done
But I get this error:
ssh connect to host xxxxxx port 22: Connection timed out
ssh scp
add a comment |Â
up vote
0
down vote
favorite
so I have this bash script right here. Basically, it connects my machine to a server and download files from the server and store them in the /tmp directory. The problem is that the bash script stops at the openvpn command and doesn't read what's next, even if the openvpn is in background. Any help please?
Sites=`ls`
for site in $Sites
do
((i=0))
cd $site/vpn
address="$(grep "172" info-$site.txt | cut -c 5-17)"
echo "IP: $address"
ret="$(route | grep "172.16" | cut -c 1-10)"
echo 'password_1' | sudo -S openvpn --config $site.ovpn --auth-user-pass $1$2/$site/vpn/login-$site.txt &
while [ X"$ret" = X"" -o "$i" -le 10 ]; do
echo "toto while"
ret="$(route | grep "172.16" | cut -c 1-10)"
sleep 1
let "i=i+1"
done
sshpass -p 'password2' scp root@"$address":/usr/envitech/DataReports/* /tmp;
done
But I get this error:
ssh connect to host xxxxxx port 22: Connection timed out
ssh scp
Did you try to do this manually on thexxxxxxx
server?
â Tomasz
Mar 15 at 20:23
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
so I have this bash script right here. Basically, it connects my machine to a server and download files from the server and store them in the /tmp directory. The problem is that the bash script stops at the openvpn command and doesn't read what's next, even if the openvpn is in background. Any help please?
Sites=`ls`
for site in $Sites
do
((i=0))
cd $site/vpn
address="$(grep "172" info-$site.txt | cut -c 5-17)"
echo "IP: $address"
ret="$(route | grep "172.16" | cut -c 1-10)"
echo 'password_1' | sudo -S openvpn --config $site.ovpn --auth-user-pass $1$2/$site/vpn/login-$site.txt &
while [ X"$ret" = X"" -o "$i" -le 10 ]; do
echo "toto while"
ret="$(route | grep "172.16" | cut -c 1-10)"
sleep 1
let "i=i+1"
done
sshpass -p 'password2' scp root@"$address":/usr/envitech/DataReports/* /tmp;
done
But I get this error:
ssh connect to host xxxxxx port 22: Connection timed out
ssh scp
so I have this bash script right here. Basically, it connects my machine to a server and download files from the server and store them in the /tmp directory. The problem is that the bash script stops at the openvpn command and doesn't read what's next, even if the openvpn is in background. Any help please?
Sites=`ls`
for site in $Sites
do
((i=0))
cd $site/vpn
address="$(grep "172" info-$site.txt | cut -c 5-17)"
echo "IP: $address"
ret="$(route | grep "172.16" | cut -c 1-10)"
echo 'password_1' | sudo -S openvpn --config $site.ovpn --auth-user-pass $1$2/$site/vpn/login-$site.txt &
while [ X"$ret" = X"" -o "$i" -le 10 ]; do
echo "toto while"
ret="$(route | grep "172.16" | cut -c 1-10)"
sleep 1
let "i=i+1"
done
sshpass -p 'password2' scp root@"$address":/usr/envitech/DataReports/* /tmp;
done
But I get this error:
ssh connect to host xxxxxx port 22: Connection timed out
ssh scp
edited Mar 15 at 20:22
Tomasz
8,04052560
8,04052560
asked Mar 15 at 17:53
Manel O.
1
1
Did you try to do this manually on thexxxxxxx
server?
â Tomasz
Mar 15 at 20:23
add a comment |Â
Did you try to do this manually on thexxxxxxx
server?
â Tomasz
Mar 15 at 20:23
Did you try to do this manually on the
xxxxxxx
server?â Tomasz
Mar 15 at 20:23
Did you try to do this manually on the
xxxxxxx
server?â Tomasz
Mar 15 at 20:23
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f430450%2fhow-to-continue-bash-script-execution-after-openvpn-is-launched%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Did you try to do this manually on the
xxxxxxx
server?â Tomasz
Mar 15 at 20:23