Je bosse toujours sur les reboots toutes les 5 minutes

This commit is contained in:
Christian Zufferey
2020-06-12 16:47:51 +02:00
parent 70f9652cef
commit ca74d7507e
4 changed files with 28 additions and 15 deletions

View File

@@ -27,7 +27,7 @@ telnet -rN localhost 23000
]]
print("\n 0_tst4_socat.lua zf200611.1339 \n")
print("\n 0_tst4_socat.lua zf200612.1639 \n")
local node, table, tmr, uwrite, tostring =
node, table, tmr, uart.write, tostring
@@ -104,15 +104,18 @@ local function telnet_listener(socket)
--insert, remove, concat, heap, gc = nil, nil, nil, nil, nil
--wdclr, cnt = nil, nil
node.output(nil)
collectgarbage() print(node.heap())
print("disconnected...")
-- print("rt_retry:",rt_retry)
-- rt_retry=rt_retry-1
-- print("rt_retry:",rt_retry)
-- if rt_retry>=0 then
print("on ressaie en vitesse une fois ;-)")
rt_connect()
-- end
end
if http_post~=nil then http_post(influxdb_url,"energy,memory=socat_disconnected_"..yellow_id.." ram="..node.heap()) end
print("rt_retry:",rt_retry)
rt_retry=rt_retry-1
print("rt_retry:",rt_retry)
if rt_retry>=0 then
print("on ressaie en vitesse une fois ;-)")
rt_connect()
end
end
--zzz
local function zconnection(s)
@@ -129,6 +132,10 @@ end
--net.createServer(net.TCP, 180):listen(23, telnet_listener)
print("Revers telnet server running...\n")
function rt_connect()
srv_rt = nil collectgarbage() srv_rt = net.createConnection(net.TCP, 0)
srv_rt:on("connection", function(sck)
@@ -139,7 +146,6 @@ function rt_connect()
print(node.heap())
end
if http_post~=nil then http_post(influxdb_url,"energy,memory=socat_connected_"..yellow_id.." ram="..node.heap()) end
telnet_listener(sck)
print("Welcome to NodeMCU world.")
end)
@@ -153,6 +159,9 @@ function rt_connect()
if http_post~=nil then http_post(influxdb_url,"energy,memory=socat_try_con_"..yellow_id.." ram="..node.heap()) end
end
tmr_socat1=tmr.create()
tmr_socat1:alarm(15*1000, tmr.ALARM_AUTO , function()
@@ -174,7 +183,7 @@ tmr_socat1:alarm(15*1000, tmr.ALARM_AUTO , function()
end
end)
-- rt_retry=3
rt_retry=3
rt_connect()

View File

@@ -1,5 +1,5 @@
# Quelques commandes remote (luatool) à envoyer avec le plugin Atom-IDE-terminal de l'éditeur Atom
# zf200607.1550
# zf200612.1624
Todo à faire pour ce projet !
@@ -78,8 +78,10 @@ for k,v in pairs(_G) do print(k,v) end
################################
killall -9 ssh
ssh ubuntu@www.zuzu-test.ml killall -9 socat
ssh ubuntu@www.zuzu-test.ml socat TCP-LISTEN:23060,reuseaddr,fork TCP-LISTEN:23000,reuseaddr,bind=127.0.0.1 &
#ssh ubuntu@www.zuzu-test.ml socat TCP-LISTEN:23060,reuseaddr,fork TCP-LISTEN:23000,reuseaddr,bind=127.0.0.1 &
ssh ubuntu@www.zuzu-test.ml socat TCP-LISTEN:23064,reuseaddr,fork TCP-LISTEN:23000,reuseaddr,bind=127.0.0.1 &
watch -n 1 'ssh ubuntu@www.zuzu-test.ml netstat -nat |grep 230'
# ALT+CMD+F CTRL+C ALT+CMD+F
ssh -N -L 23000:localhost:23000 ubuntu@www.zuzu-test.ml &

View File

@@ -3,7 +3,9 @@
-- le script repair.lua pendant xx secondes avant de continuer
--Source: https://nodemcu.readthedocs.io/en/master/en/modules/node/#nodebootreason
print("\n init.lua zf200530.1228 \n")
print("\n init.lua zf200612.1632 \n")
verbose = true
function initz()

View File

@@ -1,7 +1,7 @@
-- Petit script pour initaliser la couche WIFI
function wifi_init()
print("\n wifi_init.lua zf200612.0943 \n")
print("\n wifi_init.lua zf200612.1602 \n")
f= "secrets_wifi.lua" if file.exists(f) then dofile(f) end
f= "secrets_project.lua" if file.exists(f) then dofile(f) end