ntopng/scripts/callbacks/system/shutdown.lua
2020-09-09 12:16:51 +02:00

35 lines
916 B
Lua

--
-- (C) 2013-20 - ntop.org
--
--
-- This script is executed when ntopng shuts down when
-- network interfaces are setup
--
local dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
local prefs_dump_utils = require "prefs_dump_utils"
local recovery_utils = require "recovery_utils"
require "lua_utils" -- NOTE: required by alert_utils
local alert_utils = require "alert_utils"
local recipients = require "recipients"
local recipients_instance = recipients:create()
local periodicity = 3
local now = os.time()
local ifnames = interface.getIfNames()
alert_utils.notify_ntopng_stop()
prefs_dump_utils.savePrefsToDisk()
for _, ifname in pairs(ifnames) do
interface.select(ifname)
interface.releaseEngagedAlerts()
end
recipients_instance:process_notifications(now, now + 3 --[[ deadline ]], 3 --[[ periodicity ]], true)
recovery_utils.mark_clean_shutdown()