What's new
  • 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!

How to use args: in openvpn-event?

octopus

Part of the Furniture
I trigger script from "openvpn-event" but i need that only trigger when tun12 get connected again or vpn turned off/on.
Now its triggered with all tun11-15. How to accomplish that?

openvpn-event user script that gets run when a tunnel goes up/down
custom script: Running /jffs/scripts/openvpn-event (args: tun12 1500 1558 10.xxx.0.7 )

thanks
octopus
 
Last edited:
I trigger script from "openvpn-event" but i need that only trigger when tun12 get connected again or vpn turned off/on.
Now its triggered with all tun11-15. How to accomplish that?

openvpn-event user script that gets run when a tunnel goes up/down


thanks
octopus


OpenVPN environment variables should be exposed to your openvpn-event script:

Code:
$dev

should contain the 'tun??' string.
 
Thanks for answer
Yes it's tun. I have tried in openvpn-event script:
if [ "$dev" == "tun 12" ]; then
but have not that working.

octopus
 
Last edited:
On my side/jffs/scripts/openvpn-event is called only when I start/stop OpenVPN client from WebU. It's never called automatically when VPN connection terminated or restored.

Also, I don't know why there is no args when it's coming up:
Code:
# tail -f /tmp/syslog.log | grep 'custom script'
Jan 21 17:00:04 custom script: Running /jffs/scripts/openvpn-event (args: )
When it goes down (manually!), args seems OK:
Code:
# tail -f /tmp/syslog.log | grep 'custom script'
Jan 21 16:59:36 custom script: Running /jffs/scripts/openvpn-event (args: tun11 1500 1542 10.8.0.6 10.8.0.5 init)

RT-N66U with the last asuswrt-merlin release.
 
On my side/jffs/scripts/openvpn-event is called only when I start/stop OpenVPN client from WebU. It's never called automatically when VPN connection terminated or restored.

Also, I don't know why there is no args when it's coming up:
Code:
# tail -f /tmp/syslog.log | grep 'custom script'
Jan 21 17:00:04 custom script: Running /jffs/scripts/openvpn-event (args: )
When it goes down (manually!), args seems OK:
Code:
# tail -f /tmp/syslog.log | grep 'custom script'
Jan 21 16:59:36 custom script: Running /jffs/scripts/openvpn-event (args: tun11 1500 1542 10.8.0.6 10.8.0.5 init)

RT-N66U with the last asuswrt-merlin release.

Check the syslog in this post..and the arg patch by @john9527

http://www.snbforums.com/threads/clear-delete-vpn-profile-from-router.29899/#post-232902
 
That is working now :)

I need to write to nvram but not write every time, probably missed something, something suggestion?
echo "rc='$curlvpn'" | nvram set ip_vpn=$curlvpn

thanks
octopus
 
Code:
#!/bin/sh
if [ "$1" == "tun11" -a "$6" == "init" ]
 then
   logger "VPN disattiva Fermo Transmission.."
   /opt/etc/init.d/S88transmission stop
fi

if [ "$1" == "tun11" -a "$6" == "" ]
  then
    logger "VPN attiva avvio Transmission"
    /opt/etc/init.d/S88transmission restart
fi
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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