mod_posix: Hook and fire events on SIGUSR1/2
authorMatthew Wild <mwild1@gmail.com>
Fri, 16 Oct 2020 14:01:25 +0100
changeset 11183 96da09c771a1
parent 11182 44bcddecf1b5
child 11184 ab820b2ad199
mod_posix: Hook and fire events on SIGUSR1/2
plugins/mod_posix.lua
--- a/plugins/mod_posix.lua	Fri Oct 16 13:44:51 2020 +0100
+++ b/plugins/mod_posix.lua	Fri Oct 16 14:01:25 2020 +0100
@@ -147,5 +147,20 @@
 			prosody.shutdown("Received SIGINT");
 			prosody.lock_globals();
 		end);
+
+		signal.signal("SIGUSR1", function ()
+			module:log("info", "Received SIGUSR1");
+			module:fire_event("signal/SIGUSR1");
+		end);
+
+		signal.signal("SIGUSR2", function ()
+			module:log("info", "Received SIGUSR2");
+			module:fire_event("signal/SIGUSR2");
+		end);
 	end);
 end
+
+-- For other modules to reference
+features = {
+	signal_events = true;
+};