mirror of
https://github.com/gSpotx2f/luci-app-internet-detector.git
synced 2025-12-06 03:26:50 +03:00
modules: Module.onExit().
This commit is contained in:
34
README.md
34
README.md
@@ -10,27 +10,29 @@ Internet-detector is an application for checking the availability of the Interne
|
||||
- Sending email notification when Internet access is restored (internet-detector-mod-email).
|
||||
- The daemon is written entirely in Lua using the luaposix library.
|
||||
|
||||
**OpenWrt >= 21.02.**
|
||||
|
||||
**Dependences:** lua, luaposix, libuci-lua.
|
||||
|
||||
## Installation notes (OpenWrt >= 21.02)
|
||||
## Installation notes:
|
||||
|
||||
opkg update
|
||||
wget --no-check-certificate -O /tmp/internet-detector_1.4.4-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector_1.4.4-r1_all.ipk
|
||||
opkg install /tmp/internet-detector_1.4.4-r1_all.ipk
|
||||
rm /tmp/internet-detector_1.4.4-r1_all.ipk
|
||||
wget --no-check-certificate -O /tmp/internet-detector_1.4.5-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector_1.4.5-r1_all.ipk
|
||||
opkg install /tmp/internet-detector_1.4.5-r1_all.ipk
|
||||
rm /tmp/internet-detector_1.4.5-r1_all.ipk
|
||||
service internet-detector start
|
||||
service internet-detector enable
|
||||
|
||||
wget --no-check-certificate -O /tmp/luci-app-internet-detector_1.4.4-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-app-internet-detector_1.4.4-r1_all.ipk
|
||||
opkg install /tmp/luci-app-internet-detector_1.4.4-r1_all.ipk
|
||||
rm /tmp/luci-app-internet-detector_1.4.4-r1_all.ipk
|
||||
wget --no-check-certificate -O /tmp/luci-app-internet-detector_1.4.5-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-app-internet-detector_1.4.5-r1_all.ipk
|
||||
opkg install /tmp/luci-app-internet-detector_1.4.5-r1_all.ipk
|
||||
rm /tmp/luci-app-internet-detector_1.4.5-r1_all.ipk
|
||||
service rpcd restart
|
||||
|
||||
i18n-ru:
|
||||
|
||||
wget --no-check-certificate -O /tmp/luci-i18n-internet-detector-ru_1.4.4-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-i18n-internet-detector-ru_1.4.4-r1_all.ipk
|
||||
opkg install /tmp/luci-i18n-internet-detector-ru_1.4.4-r1_all.ipk
|
||||
rm /tmp/luci-i18n-internet-detector-ru_1.4.4-r1_all.ipk
|
||||
wget --no-check-certificate -O /tmp/luci-i18n-internet-detector-ru_1.4.5-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-i18n-internet-detector-ru_1.4.5-r1_all.ipk
|
||||
opkg install /tmp/luci-i18n-internet-detector-ru_1.4.5-r1_all.ipk
|
||||
rm /tmp/luci-i18n-internet-detector-ru_1.4.5-r1_all.ipk
|
||||
|
||||
## Screenshots:
|
||||
|
||||
@@ -42,9 +44,9 @@ i18n-ru:
|
||||
|
||||
**Dependences:** modemmanager.
|
||||
|
||||
wget --no-check-certificate -O /tmp/internet-detector-mod-modem-restart_1.4.4-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-modem-restart_1.4.4-r1_all.ipk
|
||||
opkg install /tmp/internet-detector-mod-modem-restart_1.4.4-r1_all.ipk
|
||||
rm /tmp/internet-detector-mod-modem-restart_1.4.4-r1_all.ipk
|
||||
wget --no-check-certificate -O /tmp/internet-detector-mod-modem-restart_1.4.5-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-modem-restart_1.4.5-r1_all.ipk
|
||||
opkg install /tmp/internet-detector-mod-modem-restart_1.4.5-r1_all.ipk
|
||||
rm /tmp/internet-detector-mod-modem-restart_1.4.5-r1_all.ipk
|
||||
service internet-detector restart
|
||||
|
||||

|
||||
@@ -53,9 +55,9 @@ i18n-ru:
|
||||
|
||||
**Dependences:** mailsend.
|
||||
|
||||
wget --no-check-certificate -O /tmp/internet-detector-mod-email_1.4.4-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-email_1.4.4-r1_all.ipk
|
||||
opkg install /tmp/internet-detector-mod-email_1.4.4-r1_all.ipk
|
||||
rm /tmp/internet-detector-mod-email_1.4.4-r1_all.ipk
|
||||
wget --no-check-certificate -O /tmp/internet-detector-mod-email_1.4.5-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-email_1.4.5-r1_all.ipk
|
||||
opkg install /tmp/internet-detector-mod-email_1.4.5-r1_all.ipk
|
||||
rm /tmp/internet-detector-mod-email_1.4.5-r1_all.ipk
|
||||
service internet-detector restart
|
||||
|
||||

|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=internet-detector-mod-email
|
||||
PKG_VERSION:=1.4.4
|
||||
PKG_VERSION:=1.4.5
|
||||
PKG_RELEASE:=1
|
||||
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector>
|
||||
|
||||
|
||||
@@ -189,4 +189,8 @@ function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
|
||||
end
|
||||
end
|
||||
|
||||
function Module:onExit()
|
||||
return true
|
||||
end
|
||||
|
||||
return Module
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=internet-detector-mod-modem-restart
|
||||
PKG_VERSION:=1.4.4
|
||||
PKG_VERSION:=1.4.5
|
||||
PKG_RELEASE:=1
|
||||
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector>
|
||||
|
||||
|
||||
@@ -99,4 +99,8 @@ function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
|
||||
end
|
||||
end
|
||||
|
||||
function Module:onExit()
|
||||
return true
|
||||
end
|
||||
|
||||
return Module
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=internet-detector
|
||||
PKG_VERSION:=1.4.4
|
||||
PKG_VERSION:=1.4.5
|
||||
PKG_RELEASE:=1
|
||||
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector>
|
||||
|
||||
|
||||
@@ -593,6 +593,10 @@ function InternetDetector:run()
|
||||
|
||||
self:mainLoop()
|
||||
|
||||
for _, e in ipairs(self.modules) do
|
||||
e:onExit()
|
||||
end
|
||||
|
||||
self:removeProcessFiles()
|
||||
if self.enableLogger then
|
||||
self:writeLogMessage("info", "stoped")
|
||||
|
||||
@@ -39,6 +39,13 @@ function Module:setLedAttrs(t)
|
||||
t.ledBrightnessFile = string.format("%s/brightness", t.ledDir)
|
||||
t.ledMaxBrightness = self.readValue(t.ledMaxBrightnessFile) or 1
|
||||
t.ledTriggerFile = string.format("%s/trigger", t.ledDir)
|
||||
t.ledPrevState = {
|
||||
brightness = self.readValue(t.ledBrightnessFile),
|
||||
trigger = self.readValue(t.ledTriggerFile),
|
||||
}
|
||||
if t.ledPrevState.trigger then
|
||||
t.ledPrevState.trigger = t.ledPrevState.trigger:match("%[%w+%]"):gsub("[%]%[]", "")
|
||||
end
|
||||
end
|
||||
|
||||
function Module:checkLed(t)
|
||||
@@ -53,8 +60,6 @@ function Module:init(t)
|
||||
end
|
||||
if t.led1_name then
|
||||
self._enabled = true
|
||||
-- Reset all LEDs
|
||||
--self:resetLeds()
|
||||
else
|
||||
return
|
||||
end
|
||||
@@ -155,4 +160,17 @@ function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
|
||||
self._counter = self._counter + timeDiff
|
||||
end
|
||||
|
||||
function Module:onExit()
|
||||
for _, l in ipairs(self._leds) do
|
||||
if l.ledPrevState then
|
||||
if l.ledPrevState.brightness then
|
||||
self.writeValue(l.ledBrightnessFile, l.ledPrevState.brightness)
|
||||
end
|
||||
if l.ledPrevState.trigger then
|
||||
self.writeValue(l.ledTriggerFile, l.ledPrevState.trigger)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return Module
|
||||
|
||||
@@ -141,4 +141,8 @@ function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
|
||||
end
|
||||
end
|
||||
|
||||
function Module:onExit()
|
||||
return true
|
||||
end
|
||||
|
||||
return Module
|
||||
|
||||
@@ -419,4 +419,8 @@ function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
|
||||
self._counter = self._counter + timeDiff
|
||||
end
|
||||
|
||||
function Module:onExit()
|
||||
return true
|
||||
end
|
||||
|
||||
return Module
|
||||
|
||||
@@ -52,4 +52,8 @@ function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
|
||||
end
|
||||
end
|
||||
|
||||
function Module:onExit()
|
||||
return true
|
||||
end
|
||||
|
||||
return Module
|
||||
|
||||
@@ -59,4 +59,8 @@ function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
|
||||
end
|
||||
end
|
||||
|
||||
function Module:onExit()
|
||||
return true
|
||||
end
|
||||
|
||||
return Module
|
||||
|
||||
@@ -66,4 +66,8 @@ function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
|
||||
end
|
||||
end
|
||||
|
||||
function Module:onExit()
|
||||
return true
|
||||
end
|
||||
|
||||
return Module
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-internet-detector
|
||||
PKG_VERSION:=1.4.4
|
||||
PKG_VERSION:=1.4.5
|
||||
PKG_RELEASE:=1
|
||||
LUCI_TITLE:=LuCI support for internet-detector
|
||||
LUCI_DEPENDS:=+internet-detector
|
||||
|
||||
Reference in New Issue
Block a user