I could use a little help on this one. I am a novice scripter at best. I am trying to write a bash script to connect to my multiple openvpn sites. I am trying to write the script to open in a detached screen. I have managed to write the script to connect to the different .ovpn via different variables. Getting them to run in the detached screen is what I am having trouble with. Hoping one of you guys might be able to help me. Currently I am just running
screen -S vpn
then once the screen opens up, I execute my script to connect to the openvpn sites. Here is my current vpn connection script:
#!/bin/bash
if [ "$1" = "seed-rl" ] ;
then
cd "/home/robbiel811/vpn configs"
echo password | sudo -S openvpn --config seed-rl.ovpn
fi
if [ "$1" = "atl10" ] ;
then
cd "/home/robbiel811/vpn configs"
echo password | sudo -S openvpn --config Atlanta-10.ovpn
fi
if [ "$1" = "atl11" ] ;
then
cd "/home/robbiel811/vpn configs"
echo password | sudo -S openvpn --config Atlanta-11.ovpn
fi
if [ "$1" = "atl12" ] ;
then
cd "/home/robbiel811/vpn configs"
echo password | sudo -S openvpn --config Atlanta-12.ovpn
fi
if [ "$1" = "nyc02" ] ;
then
cd "/home/robbiel811/vpn configs"
echo password | sudo -S openvpn --config NewYork-02.ovpn
fi
if [ "$1" = "nyc10" ] ;
then
cd "/home/robbiel811/vpn configs"
echo password | sudo -S openvpn --config NewYork-10.ovpn
fi
if [ "$1" = "nyc11" ] ;
then
cd "/home/robbiel811/vpn configs"
echo password | sudo -S openvpn --config NewYork-11.ovpn
fi
What can I do to make this script run in a detached screen?