Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
tty228 committed Aug 29, 2021
1 parent 703f3b2 commit 48f8ea0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
1 change: 0 additions & 1 deletion luasrc/model/cbi/serverchan/advanced.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ a.datatype="uinteger"
a=s:option(Value, "soc_code", "自定义温度读取命令")
a.rmempty = true
a:value("",translate("默认"))
a:value("sensors",translate("sensors命令"))
a.description = translate("请尽量避免使用特殊符号,如双引号、$、!等,执行结果需为数字,用于温度对比")

a=s:option(Button,"soc",translate("测试温度命令"))
Expand Down
6 changes: 6 additions & 0 deletions root/usr/bin/serverchan/api/ipv4.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
www.cip.cc
ipv4.ddnspod.com
ifcfg.cn
speed.neu.edu.cn/getIP.php
ddns.oray.com/checkip
www.net.cn/static/customercare/yourip.asp
5 changes: 5 additions & 0 deletions root/usr/bin/serverchan/api/ipv6.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ip.sb
ipv6.ddnspod.com
api-ipv6.ip.sb/ip
speed.neu6.edu.cn/getIP.php
v6.myip.la/json
14 changes: 10 additions & 4 deletions root/usr/bin/serverchan/serverchan
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ function get_config(){

# 初始化设置信息
function read_config(){
get_config "serverchan_enable" "sckey" "tg_token" "chat_id" "pushplus_token" "serverchan_ipv4" "ipv4_interface" "serverchan_ipv6" "ipv6_interface" "serverchan_up" "serverchan_down" "serverchan_sheep" "serverchan_whitelist" "serverchan_blacklist" "serverchan_interface" "starttime" "endtime" "cpuload_enable" "cpuload" "temperature_enable" "temperature" "device_name" "err_enable" "network_err_event" "err_sheep_enable" "system_time_event" "autoreboot_time" "network_restart_time" "public_ip_event" "public_ip_retry_count" "soc_code" "sleeptime" "up_timeout" "down_timeout" "device_aliases" "debuglevel" "cpuload" "temperature" "send_mode" "regular_time" "regular_time_2" "regular_time_3" "interval_time" "thread_num" "timeout_retry_count" "err_device_aliases" "oui_dir" "oui_data" "client_usage" "client_usage_max" "client_usage_disturb" "client_usage_whitelist" "reset_regularly" "lite_enable" "MAC_online_list" "MAC_offline_list" "wxpusher_apptoken" "wxpusher_uids" "wxpusher_topicIds" "jsonpath" "corpid" "userid" "agentid" "corpsecret" "mediapath"
get_config "serverchan_enable" "lite_enable" "device_name" "sleeptime" "oui_data" "oui_dir" "reset_regularly" "debuglevel" "device_aliases" \
"serverchan_ipv4" "ipv4_interface" "serverchan_ipv6" "ipv6_interface" "serverchan_up" "serverchan_down" "cpuload_enable" "cpuload" "temperature_enable" "temperature" "client_usage" "client_usage_max" "client_usage_disturb" "client_usage_whitelist" \
"regular_time" "regular_time_2" "regular_time_3" "interval_time" \
"serverchan_sheep" "starttime" "endtime" "serverchan_whitelist" "serverchan_blacklist" "serverchan_interface" "MAC_online_list" "MAC_offline_list" \
"up_timeout" "down_timeout" "timeout_retry_count" "thread_num" "soc_code" "err_enable" "err_sheep_enable" "err_device_aliases" "network_err_event" "system_time_event" "autoreboot_time" "network_restart_time" "public_ip_event" "public_ip_retry_count" \
"jsonpath" "sckey" "corpid" "userid" "agentid" "corpsecret" "mediapath" "wxpusher_apptoken" "wxpusher_uids" "wxpusher_topicIds" "pushplus_token" "tg_token" "chat_id"

for str_version in "wrtbwmon" "iputils-arping" "curl" "iw"; do
eval `echo ${str_version:0:2}"_version"`=`opkg list-installed|grep -w ^${str_version}|awk '{print $3}'` 2>/dev/null
done
Expand Down Expand Up @@ -235,8 +241,8 @@ function getcpu(){

# 获取SOC温度 (取所有传感器温度最大值)
function soc_temp(){
[ -z "$soc_code" ] && soc_code="cat /sys/class/thermal/thermal_zone*/temp|sort -nr|head -n1|cut -c-2"
[ "$soc_code" == "sensors" ] && soc_code="sensors|grep °C|sed -nr 's#^.*:.*\+(.*)°C .*#\1#gp'|sort -nr|head -n1"
[ -z "$soc_code" ] && local soctemp="sensors 2>/dev/null|grep °C|sed -nr 's#^.*:.*\+(.*)°C .*#\1#gp'|sort -nr|head -n1"
[ -z "$soc_code" ] && [ -z "$soctemp" ] && local soctemp="cat /sys/class/thermal/thermal_zone*/temp 2>/dev/null|sort -nr|head -n1|cut -c-2"
echo "$soc_code"|awk '{run=$0;system(run)}' 2>/dev/null
}

Expand Down Expand Up @@ -938,7 +944,7 @@ function cputop(){
function send(){
echo "`date "+%Y-%m-%d %H:%M:%S"` 【定时数据】创建定时任务" >> ${logfile}
serverchan_disturb;local send_disturb=$?
get_config "send_title" "router_status" "client_list" "router_temp" "router_wan"
get_config "send_title" "router_status" "router_temp" "router_wan" "client_list"

[ -z "$send_title" ] && local send_title="路由状态:"
[ ! -z "$1" ] && local send_title="发送测试:" && local send_content="${str_splitline}${str_title_start}内容1${str_title_end}${str_linefeed}${str_tab}设备1${str_linefeed}${str_tab}设备2${str_splitline}${str_title_start}内容2${str_title_end}${str_linefeed}${str_tab}设备3${str_linefeed}${str_tab}设备4"
Expand Down

0 comments on commit 48f8ea0

Please sign in to comment.