mirror of
https://github.com/JamesonHuang/OpenWrt_Luci_Lua.git
synced 2024-11-23 22:00:11 +00:00
update mzrts_monitor.sh
This commit is contained in:
parent
c10b81e6db
commit
ece6c95a1b
60
1_4.h13_bugFix/1-4.optm_mand_upgrade/mzrts_monitor.sh
Executable file → Normal file
60
1_4.h13_bugFix/1-4.optm_mand_upgrade/mzrts_monitor.sh
Executable file → Normal file
@ -1,29 +1,71 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#===============================================================================
|
||||||
|
#
|
||||||
|
# FILE: mzrts_monitor.sh
|
||||||
|
#
|
||||||
|
# USAGE: ./mzrts_monitor.sh
|
||||||
|
#
|
||||||
|
# DESCRIPTION:
|
||||||
|
#
|
||||||
|
# OPTIONS: ---
|
||||||
|
# REQUIREMENTS: ---
|
||||||
|
# BUGS: ---
|
||||||
|
# NOTES: ---
|
||||||
|
# AUTHOR: Karl Zheng (), ZhengKarl#gmail.com
|
||||||
|
# COMPANY: Meizu
|
||||||
|
# CREATED: 2015年01月14日 21时43分00秒 CST
|
||||||
|
# REVISION: ---
|
||||||
|
#===============================================================================
|
||||||
|
|
||||||
check_mandatory_upgrade()
|
check_mandatory_upgrade()
|
||||||
{
|
{
|
||||||
echo "check_mandatory_upgrade"
|
echo "check_mandatory_upgrade"
|
||||||
touch /tmp/is_upgrading
|
|
||||||
#gen random_num
|
#gen random_num
|
||||||
min=1
|
random_num=`awk 'BEGIN{srand();print int(rand()*3600)}'`
|
||||||
max=$((3600-$min+1))
|
|
||||||
num=$(date +%s)
|
|
||||||
random_num=$(($num%$max+$min))
|
|
||||||
#end
|
#end
|
||||||
sleep ${random_num}
|
sleep ${random_num}
|
||||||
lua -e 'require("meizu.upgdfs").check_mandatory_upgrade()'
|
lua -e 'require("meizu.upgdfs").check_mandatory_upgrade()'
|
||||||
echo "mandatory_upgrade success!"
|
echo "mandatory_upgrade success!"
|
||||||
rm /tmp/is_upgrading
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mzrts_monitor()
|
mzrts_monitor()
|
||||||
{
|
{
|
||||||
|
local MZRTSMONITORLOG="/tmp/mzrts_monitor.log"
|
||||||
|
local MZRTSLOG="/tmp/mzrts.log"
|
||||||
|
local mzrts_cpu_usage=$(top -n 1 |sed -n -e '/% \/usr.*mzrt/s#%##gp'|awk '{print $7}')
|
||||||
|
if [ "x${mzrts_cpu_usage}" != "x" ];then
|
||||||
|
if [ ${mzrts_cpu_usage} -ge 30 ];then
|
||||||
|
echo "mzrts_cpu_usage: ${mzrts_cpu_usage}"
|
||||||
|
echo "killall mzrts"
|
||||||
|
killall mzrts
|
||||||
|
sleep 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
local is_mzrts_run="$(ps w|grep /usr/bin/mzrts|grep -v 'mzrts_monitor'|grep -v 'grep'| wc -l)"
|
||||||
|
if [ ${is_mzrts_run} -lt 1 ];then
|
||||||
|
echo "" >> ${MZRTSMONITORLOG}
|
||||||
|
date >> ${MZRTSMONITORLOG}
|
||||||
|
echo "/usr/bin/mzrts -llon | tee -a ${MZRTSLOG} &"
|
||||||
|
/usr/bin/mzrts -llon | tee -a ${MZRTSLOG} &
|
||||||
|
echo "" >> ${MZRTSMONITORLOG}
|
||||||
|
else
|
||||||
|
echo "is_mzrts_run: ${is_mzrts_run}"
|
||||||
|
fi
|
||||||
|
local timers=$(date +%H)
|
||||||
if [ ${timers} -ge 18 ] && [ ${timers} -le 19 ];then
|
if [ ${timers} -ge 18 ] && [ ${timers} -le 19 ];then
|
||||||
if [ ! -f "/tmp/is_upgrading" ];then
|
if [ ! -f "/tmp/is_upgrading" ];then
|
||||||
|
touch /tmp/is_upgrading
|
||||||
check_mandatory_upgrade &
|
check_mandatory_upgrade &
|
||||||
|
rm /tmp/is_upgrading
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
[ -e /tmp/testTimeout.html ] && rm /tmp/testTimeout.html
|
||||||
|
sh -c '/usr/bin/timeout -t 3 /usr/bin/wget "http://127.0.0.1/cgi-bin/luci/bs/testTimeout" -q -O /tmp/testTimeout.html'
|
||||||
|
[ ! -e /tmp/testTimeout.html ] && echo "/etc/init.d/uhttpd restart" && /etc/init.d/uhttpd restart
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while [ true ];
|
||||||
|
do
|
||||||
|
sleep 3
|
||||||
|
mzrts_monitor
|
||||||
|
done
|
||||||
|
26
1_4.h13_bugFix/1-5.ww_get_wireless_channel_bug/sipfs.lua
Normal file
26
1_4.h13_bugFix/1-5.ww_get_wireless_channel_bug/sipfs.lua
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
diff --git a/package/meizu/binary/files/dev_lua/usr/lib/lua/meizu/sipfs.lua b/package/meizu/binary/files/dev_lua/usr/lib/lua/meizu/sipfs.lua
|
||||||
|
index f5c7659..2aef8ae 100644
|
||||||
|
--- a/package/meizu/binary/files/dev_lua/usr/lib/lua/meizu/sipfs.lua
|
||||||
|
+++ b/package/meizu/binary/files/dev_lua/usr/lib/lua/meizu/sipfs.lua
|
||||||
|
@@ -431,7 +431,19 @@ sip_cmd_process_action = {
|
||||||
|
sip_response_uploader(cmd, cmdid, data)
|
||||||
|
end,
|
||||||
|
["getWirelessChannel"] = function(cmd, cmdid)
|
||||||
|
- local ret = ww_get_wireless_channel()
|
||||||
|
+ local data = sip_get_parameters(cmdid)
|
||||||
|
+ local jsr = cjson.decode(data)
|
||||||
|
+ local value = jsr.value
|
||||||
|
+ local ret = ""
|
||||||
|
+ if (jsr.code) == "200" then
|
||||||
|
+ for k, v in pairs(value) do
|
||||||
|
+ if k == "commandRequest" then
|
||||||
|
+ local jsr = cjson.decode(v)
|
||||||
|
+ local wl_type = jsr.type
|
||||||
|
+ ret = ww_get_wireless_channel(wl_type)
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
sip_response_uploader(cmd, cmdid, ret)
|
||||||
|
end,
|
||||||
|
["setWirelessChannel"] = function(cmd, cmdid)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user