Having trouble with a disconnect script

Got a problem with Viscosity or need help? Ask here!

Eric

User avatar
Posts: 1146
Joined: Sun Jan 03, 2010 3:27 am

Post by Eric » Wed Sep 04, 2013 11:09 am
Hi ggg777,

Just need to determine exactly what you are trying to do. Am I correct in saying you have written this script in the event of an unexpected dropout? When this drop out occurs, can you describe exactly what you would like to occur. I am assuming you want to cut access to the internet while you kill utorrent.exe, then you want a reconnect to take place?

remap-usr1 SIGTERM tells OpenVPN that in the event of an unexpected error or drop out, to terminate the connection and not to try to reconnect, so this will actually be causing any issues you are having with Viscosity trying to automatically reconnect. The only time that Viscosity will try to reconnect with this command is when your Internet or Wireless drops out (as opposed to your VPN Provider dropping for example).

I assume you're using the timeout because taskkill is taking a while to terminate your process. If this is the case, we have an example VBS script on our Scripting KB that might help, we have found that it is instantaneous in killing processes, where taskkill tries to gracefully terminate processes, even if you specify /F - http://www.sparklabs.com/support/viswin_scripting/

You are correct in saying that you can then write a simple script to restart your program and place it in the Connected script option.

Regards,

Eric
Eric Thorpe
Viscosity Developer

Web: http://www.sparklabs.com
Support: http://www.sparklabs.com/support
Twitter: http://twitter.com/sparklabs

ggg777

Posts: 2
Joined: Wed Sep 04, 2013 8:09 am

Post by ggg777 » Thu Sep 05, 2013 10:02 am
Hi Eric,

Firstly, thanks for taking the time.
am assuming you want to cut access to the internet while you kill utorrent.exe, then you want a reconnect to take place?
Yes, that is correct.
remap-usr1 SIGTERM tells OpenVPN that in the event of an unexpected error or drop out, to terminate the connection and not to try to reconnect, so this will actually be causing any issues you are having with Viscosity trying to automatically reconnect. The only time that Viscosity will try to reconnect with this command is when your Internet or Wireless drops out (as opposed to your VPN Provider dropping for example).
Ok so.. but since my script does have my Wireless connection disconnect, then reconnect.. that basically describes the scenario in your last sentence, so that's why it sometimes works? (I'm guessing).
So I should just remove that command entirely then, and it should then try to re-connect every time.
I assume you're using the timeout because taskkill is taking a while to terminate your process. If this is the case, we have an example VBS script on our Scripting KB that might help, we have found that it is instantaneous in killing processes, where taskkill tries to gracefully terminate processes, even if you specify /F - http://www.sparklabs.com/support/viswin_scripting/
Yes the timeout is in case it takes some time to kill the process, you are again correct. I will take a look and test it out, and hopefully report back the complete success of my Viscosity setup. ;)

Thanks again,
12 posts Page 2 of 2