Software /
code /
prosody-modules
Changeset
2773:7a4e8dbbd30d
mod_traceback: Write current stack trace to file on SIGUSR1
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 25 Sep 2017 11:20:05 +0100 |
parents | 2772:2c59f2f0c37d |
children | 2774:41565a743cad |
files | mod_traceback/mod_traceback.lua |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_traceback/mod_traceback.lua Mon Sep 25 11:20:05 2017 +0100 @@ -0,0 +1,11 @@ +module:set_global(); + +local traceback = require "util.debug".traceback; + +require"util.signal".signal(module:get_option_string(module.name, "SIGUSR1"), function () + module:log("info", "Received SIGUSR1, writing traceback"); + local f = io.open(prosody.paths.data.."/traceback.txt", "a+"); + f:write(traceback(), "\n"); + f:close(); +end); +