5276 questions

6429 answers

10373 comments

6439 members

0 votes
88 views 0 comments
by
Hi. I have rut240 and its connected to OpenVPN tunnel (client), some reason it disconnects from tunnel sometimes...
Device have the internet connection ok and when i send "vpnon" command via sms it reconnect to the tunnel.

Can someone guide me how to do a script witch performs this automatically if the ping to vpn server doesn't go through.

1 Answer

0 votes
by

Hello,

As Teltonika does not write custom scripts for our clients, I can only give you suggestions. This script should be simple, you only need to ping the tunnel and write condition if you do not get a response to send vpnon command. Also, you will need to run this scripts continuously. To do that you can use crontab functionality: 

  • Log into the router using SSH client;
  • Use command crontab -e;
  • Add additional line to crontab, for example: ***** /root/test.sh

In this example script will run every single minute.

Crontab syntax explanation:

# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday;
# │ │ │ │ │                                   7 is also Sunday on some systems)
# │ │ │ │ │
# │ │ │ │ │
# * * * * * <command to execute>

Or you can use an ampersand (&) at the end of your command, for example:

somescript.sh &

and it will run in the background after you execute it even if the terminal window is closed.

Regards.