4 ITB (insidethebox) minetest game - Copyright (C) 2017-2018 sofar & nore
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public License
8 as published by the Free Software Foundation; either version 2.1
9 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 -- print server status (version, uptime, max_lag, clients) every 5 minutes
27 local function print_status()
28 local clients
= function()
30 for _
, v
in pairs(minetest
.get_connected_players()) do
31 if s
~= "" then s
= s
.. " " end
32 s
= s
.. v
:get_player_name()
36 local clientcount
= function()
38 for _
, _
in pairs(minetest
.get_connected_players()) do
44 minetest
.log("action",
45 "|minetest server status report|" ..
46 "version=\"" .. minetest
.get_version().string .. "\", " ..
47 "uptime=\"" .. math
.floor(minetest
.get_server_uptime() / 86400) .. "\", " ..
48 "max_lag=\"" .. math
.floor(minetest
.get_server_max_lag() * 1000)/1000 .. "\", " ..
49 "client_count=\"" .. clientcount() .. "\", " ..
50 "clients=\"" .. clients() .. "\""
53 minetest
.after(300, print_status
)
55 minetest
.after(10, print_status
)