3752 questions

4658 answers

7015 comments

4867 members

0 votes
187 views 34 comments
by

Hello support. I tried to run sh script on my rutx11 but it wont run!!! On other devices works perfectly. How it possible to run it on the ritx11???? That what I have 

root@Teltonika-RUTX11:~# sh /usr/bin/ScripT                                                                         
/usr/bin/ScripT: line 33: syntax error: unexpected "done" (expecting "then")                                        
root@Teltonika-RUTX11:~#

by
..............................

2 Answers

0 votes
by
Hello,

Please paste your script here. It is hard to determine the issue without the script itself.
by

For your original script to work:

Make sure router has an internet access (IMPORTANT)

1. Change first line to #!/bin/bash in your script (IMPORTANT)

2. In routers CLI or SSH shell: (IMPORTANT)

opkg update

opkg install bash

3. make script executable (IMPORTANT)

chmod +x /bin/yourscript

4. run script

yourscript

by

Installing bash (4.4.18-2) to root...                                                                               

Downloading http://downloads.openwrt.org/releases/18.06.8/packages/arm_cortex-a7_neon-vfpv4/packages/bash_4.4.18-2_ar

m_cortex-a7_neon-vfpv4.ipk                                                                                          

Configuring bash.                                                                                                   

root@Teltonika-RUTX11:~# chmod +x /bin/ScripT1                                                                      

root@Teltonika-RUTX11:~# ScripT1                                                                                    

-ash: ScripT1: not found                                                                                            

root@Teltonika-RUTX11:~#

That is inside:

#!/bin/bash
PREVSTATE=0
STRING=""
while :
do
STRING=$(ip a | grep ': wlan0:.*state UP')
#echo $STRING
if [[ $STRING == *"state UP"* ]]; then
##Put your shit here which should execute every second when the link is UP and when program is started
if [ "$PREVSTATE" = 0 ]; then
##Put your shit here which should execute ONCE when the link comes UP
iptables -t mangle -D FORWARD -j TTL --ttl-set 64
iptables -t mangle -D POSTROUTING -j TTL --ttl-set 64
iptables -t mangle -D PREROUTING -j TTL --ttl-set 64
iptables -t mangle -D PREROUTING -m ttl --ttl 1 -j TTL --ttl-inc 63
sleep 5
traceroute -m20 ya.ru
sleep 10
iptables -t mangle -A FORWARD -j TTL --ttl-set 64
iptables -t mangle -A POSTROUTING -j TTL --ttl-set 64
iptables -t mangle -A PREROUTING -j TTL --ttl-set 64
iptables -t mangle -A PREROUTING -m ttl --ttl 1 -j TTL --ttl-inc 63
sleep 5
traceroute -m20 ya.ru
echo ""
sleep 5
PREVSTATE=1
else
##Put your shit here which should execute every second when the link is DOWN
PREVSTATE=0
sleep 1
fi
fi
done

by
Dear all! I really don't understand! I tried all things but the script wont run(((((. I think im doing wrong. Something not correct. To put the script file to the /bin/ I use WinSCP. When copy after execute the command chmod -x /bin/ScripT. Then start file. Nothing happens. When change the interface also nothing! I need this script to work. But please can you provide me more options how I can make it works?
ago by
Dear support please give any possible solution to make this script run.
ago by
Please, contact your sales representative regarding further analysis of this issue.
0 votes
by
Hello,

If you copy script from one device to another device it's understandable that it may not work.
If script is simple, we understandably will check it and will provide you help, but keep please in mind, we do not support and do not guarantee that script that is not written by us will/should work.

Understandably this does not solve this issue but still, we want to help.

For additional assistance, for the possibility for additional development (scenario then we will write a script for you) please contact you Teltonika manager.
by
I understand all these things, but I didn't copy the script. This scrips was developed by me and friend and it works on other type of devices wich use openwrt. But for teltonika the script have to be written on ash shell. So that's why I ask for help with this. Looking on the script and getting feedback from your colleague it must work. But suddenly in my router doesn't . Maybe the steps which I do is wrong.
by

Please keep in mind that Teltonika devices use RutOS (it's based on OpenWRT and it's not OpenWRT).
If you want to troubleshoot this issue by yourself, I would recommend checking online guides for using ASH scripting and 6-page easy documentation for starters 

ago by
Can you check and provide working script?