What's new

Script start to early............!!??

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

octopus

Part of the Furniture
I have "openvpn-event" that call a script to get ip number from my VPN-provider. (useing canufranks script) Script executed before TUN11 is connected and no ip shows, saves ip in a file at /jffs/vpnip at then moment.
if [ "$dev" == "tun11" ]; then
sh /jffs/vpn_script.sh
ip="`cat /jffs/ip`"
logger -t $(basename $0) "$dev $ip show"
I have look at "vpn_client1_state" state 0-1-2 with no luck. Is there any way to start script after client1 have connected to my vpn-provider and tunnel is established? I also use Martineau vpn routing script.

Thanks.
Octopus
 
Last edited:
openvpn-event gets passed a bunch of environmental variables. Check the OpenVPN documentation for their list, one of them might contain the IP you need.

Otherwise, you could try inserting a "sleep 5" in there in case it's just a timing issue.
 
isnt there any "signal" tells connected and established?
openvpn-event have this, scoplink and i want vpn endpoit ip.
Canufranks script working fine just executed to early to get vpn-ipnumber.
openvpn-event (args: tun11 1500 1558 10.128.0.12 ) = scope link src 10.128.0.12
https://openvpn.net/index.php/open-source/documentation/manuals/65-openvpn-20x-manpage.html

Maby possible to use:
--route-up
Executed after connection authentication, either immediately after, or some number of seconds after as defined by the --route-delay option.


Octopus
 
Last edited:
route-up calls vpnrouting.sh, with a route-delay of 2 seconds. At the end of vpnrouting.sh there's a call for openvpn-event. So, openvpn-event should work, just make sure you check which event triggered it, as it might possibly be called for different events.
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top