This should allow the master to be restarted, for instance using ruinit,
if it exits for some reason.
---
src/haproxy.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/haproxy.c b/src/haproxy.c
index 175d3e8..998c4ff 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -983,6 +983,8 @@ static int tell_old_pids(int sig)
void run_poll_loop()
{
int next;
+ pid_t ppid = ((global.mode & MODE_MASTER_WORKER) && !is_master) ?
+ getppid() : -1;
tv_update_date(0,1);
while (1) {
@@ -1004,6 +1006,12 @@ void run_poll_loop()
if (jobs == 0)
break;
+ if (ppid > 0 && kill(ppid, 0)) {
+ send_log(NULL, LOG_INFO,
+ "Parent disappeared, exiting.\n");
+ break;
+ }
+
if (is_master) {
sleep(1);
continue;
--
1.7.2.3