From 79a2a4f18db9d16789df51ebdf2bc1b009e80f38 Mon Sep 17 00:00:00 2001 From: Dawn Chen Date: Thu, 28 May 2015 10:16:12 -0700 Subject: [PATCH] Fix the race when monit is used to monitor services which are also started at boot time via init.d at boot time. --- cluster/saltbase/salt/kube-proxy/initd | 7 +++++++ cluster/saltbase/salt/kubelet/initd | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/cluster/saltbase/salt/kube-proxy/initd b/cluster/saltbase/salt/kube-proxy/initd index 4e8f72e1b6b..658689949e3 100644 --- a/cluster/saltbase/salt/kube-proxy/initd +++ b/cluster/saltbase/salt/kube-proxy/initd @@ -40,6 +40,13 @@ DAEMON_USER=root # do_start() { + # Avoid a potential race at boot time when both monit and init.d start + # the same service + PIDS=$(pidof $DAEMON) + for PID in ${PIDS}; do + kill -9 $PID + done + # Raise the file descriptor limit - we expect to open a lot of sockets! ulimit -n 65536 diff --git a/cluster/saltbase/salt/kubelet/initd b/cluster/saltbase/salt/kubelet/initd index 5af22468ada..5379c8e07d8 100644 --- a/cluster/saltbase/salt/kubelet/initd +++ b/cluster/saltbase/salt/kubelet/initd @@ -39,6 +39,13 @@ DAEMON_USER=root # do_start() { + # Avoid a potential race at boot time when both monit and init.d start + # the same service + PIDS=$(pidof $DAEMON) + for PID in ${PIDS}; do + kill -9 $PID + done + # Return # 0 if daemon has been started # 1 if daemon was already running