I have searched the web, and the forums for the past few days and can't seem to get anyplace with what im trying to do. Sorry if this isn't the right thread but its for the vpn. I just started to learn bash scripting (specifically for this). My goal is to make it really simple for people to start the connection to the server with a double click.
I have a fedora machine that i want to be able to connect to an hda server. What i did is setup a "vpn" folder on the hard drive (/vpn). I put the certs and the key and everything i need to start the connection process in that folder. So what i would do if i were to open terminal is type
cd /vpn
openvpn --config myvpn.conf --auth-user-pass credentials
this makes it so i dont need to input my username and password.
On to the scripting part.
I created a bash script call script.sh that i put on the desktop. It seems to work just fine, i enabled it to be executable with chmod and everything. I run it and tell it to open in terminal. I watch the vpn process happen and know that its connecting and everything but once the script is complete (once it is done with that command) the terminal windows quits and in doing this it terminates the connection.
so you know what my script looks like here you go.
#!/bin/bash
cd /vpn
openvpn --config myvpn.conf --auth-user-pass credentials
so my question is, does anyone have an idea of what command i can give to keep the window alive. I have tried give a read command at the end (suggested from other forums) and i know it doesn't really exist in the bash but i tried a keepalive. Like i said i just started learning this stuff and want to keep at it. Any suggestions would help. Thank you.
Linux Open VPN Script stops - quits
Re: Linux Open VPN Script stops - quits
if the command
does not end, the window should not close.
if the window closes, that means that the client exited. i am not sure if it remains running or not. you can try to send the output to a file with > /tmp/ovpn-client.log
if it remains running and somehow gets killed by the wind because it's a parent process in the group, you can try running it with nohup (man nohup).
Code: Select all
openvpn --config myvpn.conf --auth-user-pass credentials
if the window closes, that means that the client exited. i am not sure if it remains running or not. you can try to send the output to a file with > /tmp/ovpn-client.log
if it remains running and somehow gets killed by the wind because it's a parent process in the group, you can try running it with nohup (man nohup).
Code: Select all
nohup openvpn --config myvpn.conf --auth-user-pass credentials > /tmp/ovpn-client.log &
My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 8GB RAM, 1TBx2+3TBx1
-
- Posts: 43
- Joined: Tue Dec 22, 2009 8:50 am
Re: Linux Open VPN Script stops - quits
Thanks a lot for the info CPG. I will take a look and see if thats the case.
Who is online
Users browsing this forum: No registered users and 13 guests