Mercurial > prosody-hg
comparison util/startup.lua @ 12294:81f147ddc4ab
prosody: Move last cleanup and shutdown code into util.startup
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 01 Jan 2019 16:42:52 +0100 |
| parents | 10447f940fec |
| children | 3ae9299d61d7 |
comparison
equal
deleted
inserted
replaced
| 12293:145cb8305c67 | 12294:81f147ddc4ab |
|---|---|
| 622 for hostname in pairs(config.getconfig()) do | 622 for hostname in pairs(config.getconfig()) do |
| 623 prosody.hosts[hostname] = startup.make_host(hostname); | 623 prosody.hosts[hostname] = startup.make_host(hostname); |
| 624 end | 624 end |
| 625 end | 625 end |
| 626 | 626 |
| 627 function startup.cleanup() | |
| 628 prosody.log("info", "Shutdown status: Cleaning up"); | |
| 629 prosody.events.fire_event("server-cleanup"); | |
| 630 end | |
| 631 | |
| 632 function startup.shutdown() | |
| 633 prosody.log("info", "Shutting down..."); | |
| 634 startup.cleanup(); | |
| 635 prosody.events.fire_event("server-stopped"); | |
| 636 prosody.log("info", "Shutdown complete"); | |
| 637 | |
| 638 prosody.log("debug", "Shutdown reason was: %s", prosody.shutdown_reason or "not specified"); | |
| 639 prosody.log("debug", "Exiting with status code: %d", prosody.shutdown_code or 0); | |
| 640 os.exit(prosody.shutdown_code); | |
| 641 end | |
| 642 | |
| 627 -- prosodyctl only | 643 -- prosodyctl only |
| 628 function startup.prosodyctl() | 644 function startup.prosodyctl() |
| 629 prosody.process_type = "prosodyctl"; | 645 prosody.process_type = "prosodyctl"; |
| 630 startup.parse_args(); | 646 startup.parse_args(); |
| 631 startup.init_global_state(); | 647 startup.init_global_state(); |
