Last active
December 9, 2019 08:06
-
-
Save yurenchen000/ed14d8bf05aa19330f2c7d985cc0da0b to your computer and use it in GitHub Desktop.
test cmds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//test js | |
console.log('hello') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##--------------------------------------------------------------------------------- cmd: base_info | |
## 获取 基本信息 | |
# 显示设备基本信息 | |
# mac,rom,ver,board, uptime, ip | |
echo ---------- device info ---------- | |
/lib/agent/agent_util.sh get_rom_info | awk -F= '{ printf "%15s: %s\n", $1, $2}' | |
echo | |
echo ---------- uptime info ---------- | |
now=`date +'%s'` | |
upsec=`cat /proc/uptime | awk -F. '{print $1}'` | |
up_day=$((upsec/3600/24)) | |
up_hour=$((upsec/3600%24)) | |
up_min=$((upsec%3600/60)) | |
up_sec=$((upsec%60)) | |
up=$((now-upsec)) | |
echo " now: `date +'%F %T %z' -d @$now`" | |
echo " since: `date +'%F %T %z' -d @$up`" | |
echo "uptime: $up_day day $up_hour hour $up_min min $up_sec sec" | |
echo | |
echo ---------- ipaddr info ---------- | |
ip addr | awk ' $1=="inet" && $NF!="lo" {printf "%8s %18s %s\n", $NF, $2, m} $1~"link/" {m=$2} ' | |
#ifconfig | awk '$0 ~ /^\w/' | |
#ifconfig | grep -E '^[a-z]' -A1 | |
#ifconfig | grep 'inet addr:' -B1 | |
#ifconfig | grep 'HWaddr' | |
#ip -4 addr | |
#ip -c -br addr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//--------------------------------------------------------------------------------- api: p.list | |
// 列出已装插件 | |
{ | |
"version": "1.0.0", | |
"action": "call", | |
"payload": [ | |
{ | |
"method": "plugin.list", | |
"data": {} | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##--------------------------------------------------------------------------------- cmd: wan_ssh | |
## allow wan ssh | |
uci batch <<EOF | |
set firewall.wan_ssh=rule | |
set firewall.wan_ssh.name='Allow-wan-ssh' | |
set firewall.wan_ssh.src=wan | |
set firewall.wan_ssh.proto=tcp | |
set firewall.wan_ssh.dest_port=22 | |
set firewall.wan_ssh.target=ACCEPT | |
set firewall.wan_ssh.family=ipv4 | |
commit firewall | |
EOF | |
uci export firewall | |
/etc/init.d/firewall restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment