+++ /dev/null
--- store-run-log.lua - store run.log from client -*- Lua -*-
---
--- method: POST
---
--- body: log-file section
---
--- query string:
---
--- host=<hostname>
--- user=<username>
--- project=<projectname>
-
-
-print("Content-type: text/plain\n")
-
-local cl = os.getenv("CONTENT_LENGTH")
-
-assert(cl)
-
-local log = io.read(tonumber(cl))
-local query = {}
-
-for k, v in string.gmatch(os.getenv("QUERY_STRING"), "(%w+)=([-%w_]+)") do
- query[ k ] = v
-end
-
-assert(query.host)
-assert(query.user)
-assert(query.project)
-
-local logdir = "@LOGDIR@/" .. query.project .. "/" .. query.host
-local logfile = logdir .. "/" .. query.user .. ".log"
-
-os.execute("mkdir -p '" .. logdir .. "'")
-
-local function writelog(logfile)
- local f, msg = io.open(logfile, "a")
- if not f then
- error("can not open log file `" .. logfile .. "': " .. msg)
- end
- f:write(log or "")
- f:close()
-end
-
-writelog(logfile)
-writelog("@LOGDIR@/all.log")
-
-print("ok")