|
|
Mathias Sundman wrote:
On Fri, 1 Oct 2004, franki wrote:
One last thing, its been years since I did any significanct DOS
coding.. is there a way on win2000/XP to fork a process into the
background? I'd like to put two batch files on the desktop, one to
initiate the VPN, set the route, and delete the normal locally mapped
drives (the ones people use when they are on the local network at
work) and then create the VPN mapped network drives.
The other bat file I'd like to kill the VPN, and re-establish the
normal local mapped drives ready for when they return to work.
My attempts to do this have resulted in openVPN not returning the
prompt and therefore not running anything else in the bat file until
after the vpn is ended. The last time I did any Dos work was with
6.2 or win95, which is probably why I don't know how to get it to
fork a process or return the prompt.
You cannot daemonize a process in windows, as far as I know, but you
can launch it with "start openvpn config.ovpn" which will return
control to the batch file right away.
A problem with this is that you can't map the drives until the tunnel
is accually established.
I'd recommend using the --route-up option in openvpn to call a batch
file, and in that batch file call a second batch file with "start
batch2.bat" to map the drives.
Or better yet, use my GUI (http://www.nilings.se/openvpn) to launch
openvpn :-) In the latest release (1.0-beta19) I added a feature to
execute a batch file after a connection has sucessfully been
established, and routes have been added to the system. This batch file
can map your drives directly without having to call a second batch
file with start, as it's beeing run as a diffrent thread/process than
openvpn.
You can use the --down option of openvpn to run a batch file when
closing the connection.
Thanks for the tips.
I am already running your GUI program, but after many attempts to use
the --route-up to start a batch file, I found that it wasn't waiting
till the connection was established before running, so putting the route
statement and the drive mapping in there was not successful. (I actually
found that putting a ping 127.0.0.1 into the bat file before the
others, slowed it down abit and sometimes helped, but I don't like bodgy
hacks.)
I must admit that I did not know about the --down option.. I'll
certainly look into that.
regards
Franki
____________________________________________
Openvpn-users mailing list
Openvpn-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/openvpn-users
|