134 |
134 |
135 -- Set signal handlers |
135 -- Set signal handlers |
136 if signal.signal then |
136 if signal.signal then |
137 signal.signal("SIGTERM", function () |
137 signal.signal("SIGTERM", function () |
138 module:log("warn", "Received SIGTERM"); |
138 module:log("warn", "Received SIGTERM"); |
|
139 signal.signal("SIGTERM", function () end); -- Fixes us getting into some kind of loop |
139 prosody.unlock_globals(); |
140 prosody.unlock_globals(); |
140 prosody.shutdown("Received SIGTERM"); |
141 prosody.shutdown("Received SIGTERM"); |
141 prosody.lock_globals(); |
142 prosody.lock_globals(); |
142 end); |
143 end); |
143 |
144 |
147 prosody.reopen_logfiles(); |
148 prosody.reopen_logfiles(); |
148 end); |
149 end); |
149 |
150 |
150 signal.signal("SIGINT", function () |
151 signal.signal("SIGINT", function () |
151 module:log("info", "Received SIGINT"); |
152 module:log("info", "Received SIGINT"); |
152 signal.signal("SIGINT", function () end); -- Fixes us getting into some kind of loop |
153 signal.signal("SIGINT", function () end); -- Fix to not loop |
153 prosody.unlock_globals(); |
154 prosody.unlock_globals(); |
154 prosody.shutdown("Received SIGINT"); |
155 prosody.shutdown("Received SIGINT"); |
155 prosody.lock_globals(); |
156 prosody.lock_globals(); |
156 end); |
157 end); |
157 end |
158 end |