Software / code / prosody
Comparison
prosodyctl @ 13167:6226f75f55a7
prosodyctl: Add experimental way to reload specific modules directly
Mostly thinking out loud about how various actions may use the shell
This enables the following sequence of commands:
prosodyctl install mod_example
prosodyctl reload mod_example
which is simpler than
prosodyctl shell module reload example
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 25 Jun 2023 17:34:13 +0200 |
| parent | 13059:a47bd6ea7626 |
| child | 13595:6fafe51df188 |
comparison
equal
deleted
inserted
replaced
| 13166:e6e76f64ebb6 | 13167:6226f75f55a7 |
|---|---|
| 563 if opts.help then | 563 if opts.help then |
| 564 show_usage([[reload]], [[Reload Prosody's configuration and re-open log files]]); | 564 show_usage([[reload]], [[Reload Prosody's configuration and re-open log files]]); |
| 565 return 0; | 565 return 0; |
| 566 end | 566 end |
| 567 | 567 |
| 568 if arg[1] and arg[1]:match"^mod_" then | |
| 569 -- TODO reword the usage text, document | |
| 570 local shell = require "prosody.util.prosodyctl.shell"; | |
| 571 arg[1] = arg[1]:match("^mod_(.*)"); -- strip mod_ prefix | |
| 572 table.insert(arg, 1, "module"); | |
| 573 table.insert(arg, 2, "reload"); | |
| 574 return shell.shell(arg); | |
| 575 end | |
| 576 | |
| 568 service_command_warning("reload"); | 577 service_command_warning("reload"); |
| 569 | 578 |
| 570 if not prosodyctl.isrunning() then | 579 if not prosodyctl.isrunning() then |
| 571 show_message("Prosody is not running"); | 580 show_message("Prosody is not running"); |
| 572 return 1; | 581 return 1; |