struct _trbt_tree_t *server_ids;
const char *event_script_dir;
const char *default_public_interface;
+ pid_t recoverd_pid;
};
struct ctdb_db_context {
int32_t ctdb_control_thaw(struct ctdb_context *ctdb);
int ctdb_start_recoverd(struct ctdb_context *ctdb);
+void ctdb_stop_recoverd(struct ctdb_context *ctdb);
uint32_t ctdb_get_num_active_nodes(struct ctdb_context *ctdb);
return ctdb->monitoring_mode;
case CTDB_CONTROL_SHUTDOWN:
+ ctdb_stop_recoverd(ctdb);
ctdb_release_all_ips(ctdb);
ctdb->methods->shutdown(ctdb);
ctdb_event_script(ctdb, "shutdown");
#include "system/filesys.h"
#include "system/time.h"
#include "system/network.h"
+#include "system/wait.h"
#include "popt.h"
#include "cmdline.h"
#include "../include/ctdb.h"
{
int ret;
int fd[2];
- pid_t child;
if (pipe(fd) != 0) {
return -1;
}
- child = fork();
- if (child == -1) {
+ ctdb->recoverd_pid = fork();
+ if (ctdb->recoverd_pid == -1) {
return -1;
}
- if (child != 0) {
+ if (ctdb->recoverd_pid != 0) {
close(fd[0]);
return 0;
}
DEBUG(0,("ERROR: ctdb_recoverd finished!?\n"));
return -1;
}
+
+/*
+ shutdown the recovery daemon
+ */
+void ctdb_stop_recoverd(struct ctdb_context *ctdb)
+{
+ if (ctdb->recoverd_pid == 0) {
+ return;
+ }
+
+ DEBUG(0,("Shutting down recovery daemon\n"));
+ kill(ctdb->recoverd_pid, SIGTERM);
+}