cgi/uptime/uptime.lua

23 lines
527 B
Lua
Raw Permalink Normal View History

---
permalink: /cgi/uptime/index.lua
---
-- Function to execute shell commands
local function shell_exec(command)
local handle = io.popen(command)
local result = handle:read("*a")
handle:close()
return result
end
-- Execute shell commands
2024-04-05 22:44:39 +02:00
local uptime = shell_exec('uptime -p')
--local version = shell_exec('uptime -V')
-- Output the HTTP header
io.write("Content-Type: text/plain; charset=utf-8\r\n\r\n")
-- Output the result
2024-04-05 22:44:39 +02:00
--io.write('Server ' .. version:sub(1, -2) .. ': ' .. uptime)
2024-04-30 09:37:22 +02:00
io.write(uptime)