diff options
-rw-r--r-- | cpgx/cpgx.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/cpgx/cpgx.c b/cpgx/cpgx.c index c2555ad..3681b08 100644 --- a/cpgx/cpgx.c +++ b/cpgx/cpgx.c @@ -1502,34 +1502,37 @@ int iterations_done(void) void restart_cluster(void) { - syslog(LOG_WARNING, "%ld killing %s", time(NULL), exec_name); - log_debug("killing %s", exec_name); + if (exec_addr[0]) { + log_debug("%s", iptables_a); + system(iptables_a); + } - system(iptables_a); + log_debug("killing %s %s", exec_name, exec_addr); + syslog(LOG_WARNING, "%ld killing %s %s", time(NULL), exec_name, exec_addr); if (exec_name[0] == 'a') system("killall -9 aisexec"); else system("killall -9 corosync"); + /* corosync-cfgtool -H would be better if it can work, to avoid ipc leaks */ /* others should see us fail before we rejoin, not sure 10s will be enough for some people */ sleep(restart_sec); - system(iptables_d); + if (exec_addr[0]) { + log_debug("%s", iptables_d); + system(iptables_d); + } - syslog(LOG_WARNING, "%ld starting %s", time(NULL), exec_name); - log_debug("starting %s", exec_name); + log_debug("starting %s %s", exec_name, exec_addr); + syslog(LOG_WARNING, "%ld starting %s %s", time(NULL), exec_name, exec_addr); - if (!exec_join) { + if (!exec_join) system("cman_tool join -w"); - } else { - if (exec_name[0] == 'a') - system("aisexec"); - else - system("corosync"); - } + else + system(exec_name); } void loop(void) |