ntopng/scripts/lua/admin/service_restart.lua
2020-01-08 23:52:51 +01:00

21 lines
377 B
Lua

--
-- (C) 2017-20 - ntop.org
--
local dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
require "lua_utils"
local json = require("dkjson")
sendHTTPHeader('application/json')
if not haveAdminPrivileges() then
return
end
ntop.serviceRestart()
res = { csrf = ntop.getRandomCSRFValue() }
print(json.encode(res, nil, 1))