Difference between revisions of "User Scripts examples"

From Teltonika Networks Wiki
Tags: Mobile edit Mobile web edit
Line 5: Line 5:
 
This article will provide some examples on the usage of User Scripts. Although it must be noted that one should be at least be partially familiar with the syntax and basic principles of shell scripts beforehand as this guide will not provide a tutorial on shell scripts themselves.
 
This article will provide some examples on the usage of User Scripts. Although it must be noted that one should be at least be partially familiar with the syntax and basic principles of shell scripts beforehand as this guide will not provide a tutorial on shell scripts themselves.
  
==Example 1: test script==
+
#!/bin/ash
 
+
HOST=10.10.10.10
 
+
if ping -c5 $HOST > /dev/null; then
 +
  echo "$HOST responded; VPN is up!"
 +
else
 +
  echo "$HOST did not respond; trying to restart VPN"
 +
  /usr/sbin/ipsec restart
  
 
==Example 2: filtering SMS messages==
 
==Example 2: filtering SMS messages==

Revision as of 23:25, 12 April 2022

Introduction

User Scripts is a service in RUT routers that provides the user with the possibility to create custom shell scripts that run at the end of router's boot process.

This article will provide some examples on the usage of User Scripts. Although it must be noted that one should be at least be partially familiar with the syntax and basic principles of shell scripts beforehand as this guide will not provide a tutorial on shell scripts themselves.

  1. !/bin/ash

HOST=10.10.10.10 if ping -c5 $HOST > /dev/null; then

 echo "$HOST responded; VPN is up!"

else

 echo "$HOST did not respond; trying to restart VPN"
 /usr/sbin/ipsec restart

Example 2: filtering SMS messages

Configuration examples user scripts 1.png