]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Add fsctl command to summon reincarnation
authorTravis Cross <tc@traviscross.com>
Tue, 10 Jun 2014 22:21:38 +0000 (22:21 +0000)
committerTravis Cross <tc@traviscross.com>
Tue, 10 Jun 2014 23:57:30 +0000 (23:57 +0000)
If you start freeswitch with -reincarnate or -reincarnate-reexec, FS
will restart automatically in the event of an unexpected exit.

Currently, you can cause FS to immediately call exit(0) with `fsctl
shutdown now`, or you can have it call abort() with `fsctl crash`.
Which are both nice, but if you have reincarnation engaged, you really
might want FS to call exit([non-zero]) so the great supervisor
immediately breathes life back into your system.

This is now available via `fsctl shutdown reincarnate now`.

src/include/switch_types.h
src/mod/applications/mod_commands/mod_commands.c
src/switch_core.c

index 125a35607143c0d9ae0efe996bcfd32ad068daf8..43f2375e899d12ebded44ac293be6f7abee0c411 100644 (file)
@@ -1861,6 +1861,7 @@ typedef enum {
        SCSC_DEBUG_LEVEL,
        SCSC_FLUSH_DB_HANDLES,
        SCSC_SHUTDOWN_NOW,
+       SCSC_REINCARNATE_NOW,
        SCSC_CALIBRATE_CLOCK,
        SCSC_SAVE_HISTORY,
        SCSC_CRASH,
index 581b8330e18c19da9f94ffe83691bf932b8af4a7..4ae9cf65cd0e9058943f8578eed940b65f8b7e0c 100644 (file)
@@ -2276,6 +2276,10 @@ SWITCH_STANDARD_API(ctl_function)
                                                command = SCSC_SHUTDOWN_NOW;
                                        } else if (!strcasecmp(argv[x], "asap")) {
                                                command = SCSC_SHUTDOWN_ASAP;
+                                       } else if (!strcasecmp(argv[x], "reincarnate")
+                                                          && (x+1 < argc) && argv[x+1] && !strcasecmp(argv[x+1], "now")) {
+                                               ++x;
+                                               command = SCSC_REINCARNATE_NOW;
                                        } else if (!strcasecmp(argv[x], "restart")) {
                                                arg = 1;
                                        }
@@ -6384,6 +6388,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
        switch_console_set_complete("add fsctl shutdown cancel");
        switch_console_set_complete("add fsctl shutdown elegant");
        switch_console_set_complete("add fsctl shutdown elegant restart");
+       switch_console_set_complete("add fsctl shutdown reincarnate now");
        switch_console_set_complete("add fsctl shutdown restart");
        switch_console_set_complete("add fsctl shutdown restart asap");
        switch_console_set_complete("add fsctl shutdown restart elegant");
index dc586075d33568895ffb3ce99e995bb725c10cc0..9e6b7396014603fd5dc99a6b19e33971dd6ab6c1 100644 (file)
@@ -2392,6 +2392,10 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void *
                switch_console_save_history();
                exit(0);
                break;
+       case SCSC_REINCARNATE_NOW:
+               switch_console_save_history();
+               exit(SWITCH_STATUS_RESTART);
+               break;
        case SCSC_SHUTDOWN_ELEGANT:
        case SCSC_SHUTDOWN_ASAP:
                {