diff options
Diffstat (limited to '')
-rw-r--r-- | src/daemon/commands.c (renamed from daemon/commands.c) | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/daemon/commands.c b/src/daemon/commands.c index ed544224e..8c9767a3f 100644 --- a/daemon/commands.c +++ b/src/daemon/commands.c @@ -36,7 +36,6 @@ struct command_context { /* Forward declarations */ static cmd_status_t cmd_help_execute(char *args, char **message); static cmd_status_t cmd_reload_health_execute(char *args, char **message); -static cmd_status_t cmd_save_database_execute(char *args, char **message); static cmd_status_t cmd_reopen_logs_execute(char *args, char **message); static cmd_status_t cmd_exit_execute(char *args, char **message); static cmd_status_t cmd_fatal_execute(char *args, char **message); @@ -52,7 +51,6 @@ static cmd_status_t cmd_dumpconfig(char *args, char **message); static command_info_t command_info_array[] = { {"help", cmd_help_execute, CMD_TYPE_HIGH_PRIORITY}, // show help menu {"reload-health", cmd_reload_health_execute, CMD_TYPE_ORTHOGONAL}, // reload health configuration - {"save-database", cmd_save_database_execute, CMD_TYPE_ORTHOGONAL}, // save database for memory mode save {"reopen-logs", cmd_reopen_logs_execute, CMD_TYPE_ORTHOGONAL}, // Close and reopen log files {"shutdown-agent", cmd_exit_execute, CMD_TYPE_EXCLUSIVE}, // exit cleanly {"fatal-agent", cmd_fatal_execute, CMD_TYPE_HIGH_PRIORITY}, // exit with fatal error @@ -144,21 +142,7 @@ static cmd_status_t cmd_reload_health_execute(char *args, char **message) nd_log_limits_unlimited(); netdata_log_info("COMMAND: Reloading HEALTH configuration."); - health_reload(); - nd_log_limits_reset(); - - return CMD_STATUS_SUCCESS; -} - -static cmd_status_t cmd_save_database_execute(char *args, char **message) -{ - (void)args; - (void)message; - - nd_log_limits_unlimited(); - netdata_log_info("COMMAND: Saving databases."); - rrdhost_save_all(); - netdata_log_info("COMMAND: Databases saved."); + health_plugin_reload(); nd_log_limits_reset(); return CMD_STATUS_SUCCESS; @@ -183,7 +167,7 @@ static cmd_status_t cmd_exit_execute(char *args, char **message) nd_log_limits_unlimited(); netdata_log_info("COMMAND: Cleaning up to exit."); - netdata_cleanup_and_exit(0); + netdata_cleanup_and_exit(0, NULL, NULL, NULL); exit(0); return CMD_STATUS_SUCCESS; @@ -499,15 +483,15 @@ static void parse_commands(struct command_context *cmd_ctx) status = CMD_STATUS_FAILURE; /* Skip white-space characters */ - for (pos = cmd_ctx->command_string ; isspace(*pos) && ('\0' != *pos) ; ++pos) {;} + for (pos = cmd_ctx->command_string ; isspace(*pos) && ('\0' != *pos) ; ++pos) ; for (i = 0 ; i < CMD_TOTAL_COMMANDS ; ++i) { if (!strncmp(pos, command_info_array[i].cmd_str, strlen(command_info_array[i].cmd_str))) { if (CMD_EXIT == i) { /* musl C does not like libuv workqueues calling exit() */ execute_command(CMD_EXIT, NULL, NULL); } - for (lstrip=pos + strlen(command_info_array[i].cmd_str); isspace(*lstrip) && ('\0' != *lstrip); ++lstrip) {;} - for (rstrip=lstrip+strlen(lstrip)-1; rstrip>lstrip && isspace(*rstrip); *(rstrip--) = 0 ); + for (lstrip=pos + strlen(command_info_array[i].cmd_str); isspace(*lstrip) && ('\0' != *lstrip); ++lstrip) ; + for (rstrip=lstrip+strlen(lstrip)-1; rstrip>lstrip && isspace(*rstrip); *(rstrip--) = 0 ) ; cmd_ctx->work.data = cmd_ctx; cmd_ctx->idx = i; |