23 lines
602 B
Lua
23 lines
602 B
Lua
local commons = require("lib.commons")
|
|
|
|
local _M = {}
|
|
|
|
function _M.uuid()
|
|
local uuid_cmd = "/usr/bin/uuid"
|
|
|
|
if commons.file_exists(uuid_cmd) then
|
|
local handle = io.popen(uuid_cmd)
|
|
local result = handle:read("*a")
|
|
local r2 = string.gsub(result, "%s+", "")
|
|
local r3 = string.gsub(r2,"\n","")
|
|
ngx.log(ngx.INFO, "uuid -> ", r3)
|
|
return r3
|
|
else
|
|
ngx.status = 500
|
|
ngx.log(ngx.ERR, "my_uuid *FAILED* `/usr/bin/uuid` not exists!")
|
|
ngx.say("my_uuid *FAILED* `/usr/bin/uuid` not exists!")
|
|
ngx.exit()
|
|
end
|
|
end
|
|
|
|
return _M |