mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 20:20:07 +00:00
sd_notify (systemd status notifications) support
sd_notify() is used to notify systemd of changes to the status of the process. This allows the systemd daemon to know when the process finished loading (and thus only start another program after Asterisk has finished loading). To use this, use a systemd unit with 'Type=notify' for Asterisk. This commit also adds the function ast_sd_notify(), a wrapper around sd_notify that does nothing if not built with systemd support. Also adds support for libsystemd detection in the configure script. Change-Id: Ied6a59dafd5ef331c5c7ae8f3ccd2dfc94be7811
This commit is contained in:
@@ -1999,6 +1999,9 @@ static void really_quit(int num, shutdown_nice_t niceness, int restart)
|
||||
ast_module_shutdown();
|
||||
}
|
||||
|
||||
if (!restart) {
|
||||
ast_sd_notify("STOPPING=1");
|
||||
}
|
||||
if (ast_opt_console || (ast_opt_remote && !ast_opt_exec)) {
|
||||
ast_el_write_default_histfile();
|
||||
if (consolethread == AST_PTHREADT_NULL || consolethread == pthread_self()) {
|
||||
@@ -4526,6 +4529,7 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou
|
||||
ast_register_cleanup(main_atexit);
|
||||
|
||||
run_startup_commands();
|
||||
ast_sd_notify("READY=1");
|
||||
|
||||
ast_verb(0, COLORIZE_FMT "\n", COLORIZE(COLOR_BRGREEN, 0, "Asterisk Ready."));
|
||||
|
||||
|
Reference in New Issue
Block a user