Changeset

11179:96da09c771a1

mod_posix: Hook and fire events on SIGUSR1/2
author Matthew Wild <mwild1@gmail.com>
date Fri, 16 Oct 2020 14:01:25 +0100
parents 11178:44bcddecf1b5
children 11180:ab820b2ad199
files plugins/mod_posix.lua
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;
+};