This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/24926 ) Change subject: vty: add "shutdown" ...................................................................... vty: add "shutdown" Kill programs with SIGTERM with the new vty command, as it would happen with "systemctl stop". I've considered running the select shutdown logic too in order to ensure that pending OSMO_FD_WRITE requests are serviced. But as noted in review, it's better to ensure that the regular SIGTERM code path works as expected and call that instead of introducing an alternative code path. Closes: OS#4609 Change-Id: I3596a35b0f4a24e49484ec3f24a98e4d4f583e1e --- M src/vty/command.c 1 file changed, 16 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve diff --git a/src/vty/command.c b/src/vty/command.c index 5001d06..3112fee 100644 --- a/src/vty/command.c +++ b/src/vty/command.c @@ -38,13 +38,16 @@ #include <ctype.h> #include <time.h> #include <limits.h> +#include <signal.h> #include <sys/time.h> #include <sys/stat.h> +#include <sys/types.h> #include <osmocom/vty/vector.h> #include <osmocom/vty/vty.h> #include <osmocom/vty/command.h> +#include <osmocom/core/logging.h> #include <osmocom/core/talloc.h> #include <osmocom/core/timer.h> #include <osmocom/core/utils.h> @@ -3022,6 +3025,18 @@ return CMD_SUCCESS; } +DEFUN(shutdown, + shutdown_cmd, "shutdown", "Request a shutdown of the program\n") +{ + LOGP(DLGLOBAL, LOGL_INFO, "Shutdown requested from telnet\n"); + vty_out(vty, "%s is shutting down. Bye!%s", host.app_info->name, VTY_NEWLINE); + + /* Same exit path as if it was killed by the service manager */ + kill(getpid(), SIGTERM); + + return CMD_SUCCESS; +} + /* Show version. */ DEFUN(show_version, show_version_cmd, "show version", SHOW_STR "Displays program version\n") @@ -4394,6 +4409,7 @@ install_lib_element(ENABLE_NODE, &config_disable_cmd); install_lib_element(ENABLE_NODE, &config_terminal_cmd); install_lib_element(ENABLE_NODE, ©_runningconfig_startupconfig_cmd); + install_lib_element(ENABLE_NODE, &shutdown_cmd); } install_lib_element(ENABLE_NODE, &show_startup_config_cmd); install_lib_element(ENABLE_NODE, &show_version_cmd); -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/24926 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I3596a35b0f4a24e49484ec3f24a98e4d4f583e1e Gerrit-Change-Number: 24926 Gerrit-PatchSet: 4 Gerrit-Owner: osmith <osmith at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210716/4cfffd7e/attachment.htm>