acu rtty config

acu rtty config

 

root@ACU:/etc/config# cd /tmp/
root@ACU:/tmp# ls
4g_output                etc                      mulkill_log              shm
IdSrFreq                 extroot                  mulwatch_log             spool
TZ                       gis.log                  nginx_multicast_log.txt  state
WARN_OUTPUT_FILE         hosts                    openamipfile             sysinfo
adc                      lib                      overlay                  timerlog
all_acu_info             lock                     resolv.conf              tmp
auth.sqlite              log                      resolv.conf.auto
dhcp.leases              modem_system_code        rtty_deploy.tar.gz
dnsmasq.d                modemfile                run
root@ACU:/tmp# 
root@ACU:/tmp# tar -zxvpf rtty_deploy.tar.gz -C /
etc/rc.local
etc/config/root/
etc/config/root/etc/
etc/config/root/etc/config/
etc/config/root/etc/config/rtty
etc/config/root/etc/init.d/
etc/config/root/etc/init.d/rtty
etc/config/root/usr/
etc/config/root/usr/lib/
etc/config/root/usr/lib/libev.so.4
etc/config/root/usr/lib/libev.so.4.0.0
etc/config/root/usr/lib/libev.so
etc/config/root/usr/sbin/
etc/config/root/usr/sbin/rtty
etc/config/root/usr/sbin/tree
root@ACU:/tmp# 
root@ACU:/tmp# cat /etc/rc.local 
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

[ -d "/etc/config/root" ] && cp -af /etc/config/root/* / && echo "copy file ..."
[ -f "/etc/init.d/rtty" ] && /etc/init.d/rtty start && echo "rtty start ..."

exit 0
root@ACU:/tmp# 
root@ACU:/tmp# [ -d "/etc/config/root" ] && cp -af /etc/config/root/* / && echo "copy file ..."
copy file ...
root@ACU:/tmp# 
root@ACU:/tmp# tree /etc/config/root/
/etc/config/root/
├── etc
│   ├── config
│   │   └── rtty
│   └── init.d
│       └── rtty
└── usr
    ├── lib
    │   ├── libev.so -> libev.so.4.0.0
    │   ├── libev.so.4 -> libev.so.4.0.0
    │   └── libev.so.4.0.0
    └── sbin
        ├── rtty
        └── tree

6 directories, 7 files
root@ACU:/tmp# 
root@ACU:/tmp# route 
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.120.129 0.0.0.0         UG    0      0        0 eth0.3074
192.168.1.0     *               255.255.255.0   U     0      0        0 br-lan
192.168.120.128 *               255.255.255.128 U     0      0        0 eth0.3074
192.192.192.0   *               255.255.255.0   U     0      0        0 eth0
root@ACU:/tmp# 
root@ACU:/tmp# cat /etc/config/network
config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fd4f:49c1:1bdf::/48'

config interface 'lan'
	option type 'bridge'
	option ifname 'eth1'
	option _orig_ifname 'eth1'
	option _orig_bridge 'true'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'

config switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option vid '3072'
	option ports '0 1 2 3 4'

config interface 'wan3074'
	option ifname 'eth0.3074'
	option _orig_ifname 'eth0.3074'
	option _orig_bridge 'false'
	option proto 'static'
	option ipaddr '192.168.120.130'
	option netmask '255.255.255.128'
	option gateway '192.168.120.129'
	option dns '223.5.5.5'

root@ACU:/tmp# 
root@ACU:/tmp# 
root@ACU:/tmp# route -n | grep "0.0.0.0.*0.0.0.0" | awk '{print $8}'
eth0.3074
root@ACU:/tmp# 
root@ACU:/tmp# uci set rtty.@rtty[0].ifname="$(route -n | grep "0.0.0.0.*0.0.0.0" | awk '{print $8}')"
root@ACU:/tmp# 
root@ACU:/tmp# uci set rtty.@rtty[0].id="WH_SJWX_demo_001"
root@ACU:/tmp# 
root@ACU:/tmp# uci commit rtty
root@ACU:/tmp# 
root@ACU:/tmp# uci show rtty
rtty.@rtty[0]=rtty
rtty.@rtty[0].host='10.0.8.151'
rtty.@rtty[0].port='5912'
rtty.@rtty[0].ifname='eth0.3074'
rtty.@rtty[0].id='WH_SJWX_demo_001'
root@ACU:/tmp# 
root@ACU:/tmp# 
root@ACU:/tmp# cat /etc/config/rtty > /etc/config/root/etc/config/rtty
root@ACU:/tmp#  root@ACU:/tmp# /etc/init.d/rtty stop Killed root@ACU:/tmp# root@ACU:/tmp# /etc/init.d/rtty start rtty service has started. root@ACU:/tmp# root@ACU:/tmp#

 

#!/bin/sh
#filename: gwcheck.sh

PUBIP='frpgz1.idcfengye.com'
PINGOUT='/tmp/gwping.log'
INTERFACE='br-lan'
NETZONE='lan'
TOTCOUNT=9
MINCOUNT=6
PASSCOUNT=0
PROCOUNT=0

restart_rtty()
{
 /etc/init.d/rtty stop >/dev/null 2>&1
 sleep 2
 /etc/init.d/rtty start >/dev/null 2>&1
 sleep 2
 echo "info : restart rtty done "
}


### ( Main )

while true
do
  PASSCOUNT=0
  PROCOUNT=0
  ping $PUBIP -W 2 -I $INTERFACE -c $TOTCOUNT >$PINGOUT
  PASSCOUNT=$(cat $PINGOUT | grep 'bytes from' | wc -l )
  echo "do : gwcheck ping test => total = $TOTCOUNT , min = $MINCOUNT , pass = $PASSCOUNT "
  if [ $MINCOUNT -gt $PASSCOUNT ]
  then
    echo "warn : gateway is unavailable "
    ifup $NETZONE >/dev/null 2>&1 && echo "info : ifup $NETZONE on $INTERFACE "
    sleep 2
    restart_rtty
  else
    echo "info : gateway is available"
    echo "info : ok $NETZONE on $INTERFACE"
    PROCOUNT=$( ps | grep -i rtty | grep -v grep | wc -l )
    [ $PROCOUNT -ne 1 ] && restart_rtty
  fi
  sleep 6
done

### ( End )

 

rttys - http://10.0.8.151:5913/
远程进入设备的命令行界面后, 可以执行 rtty -S ./file.ext 下载文件 ; rtty -R ./file.ext 上传文件 ;
WEB界面访问,只能访问设备同局域网的端口服务。

 

=========== End

 

posted @ 2023-07-17 12:10  lsgxeva  阅读(30)  评论(0编辑  收藏  举报