Skip to content
Snippets Groups Projects
Commit 3b32b6c3 authored by Marek Vavrusa's avatar Marek Vavrusa
Browse files

Implemented 'refresh' command to knotc.

refs #1833
parent 2401c4e0
No related branches found
No related tags found
No related merge requests found
......@@ -71,6 +71,7 @@ void help(int argc, char **argv)
" stop Stop %s server (no-op if not running).\n"
" restart Stops and then starts %s server.\n"
" reload Reload %s configuration and compiled zones.\n"
" refresh Refresh all slave zones.\n"
" running Check if server is running.\n"
" checkconf Check server configuration.\n"
"\n"
......@@ -446,11 +447,7 @@ int execute(const char *action, char **argv, int argc, pid_t pid,
log_server_warning("Server PID not found, "
"probably not running.\n");
if (has_flag(flags, F_FORCE)) {
log_server_info("Forcing server stop.\n");
} else {
return 1;
}
return 1;
}
// Recompile zones if needed
......@@ -461,8 +458,27 @@ int execute(const char *action, char **argv, int argc, pid_t pid,
// Stop
if (kill(pid, SIGHUP) < 0) {
pid_remove(pidfile);
rc = 1;
} else {
log_server_info("Server reload queued - OK.\n");
}
}
if (strcmp(action, "refresh") == 0) {
// Check PID
valid_cmd = 1;
if (pid <= 0 || !pid_running(pid)) {
log_server_warning("Server PID not found, "
"probably not running.\n");
return 1;
}
// Stop
if (kill(pid, SIGUSR2) < 0) {
rc = 1;
} else {
log_server_info("Zones refresh queued - OK.\n");
}
}
if (strcmp(action, "running") == 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment