From 1ee423bd5dd7abf6f5f4662132b77fdebf14529a Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Fri, 16 May 2014 09:36:54 -0400 Subject: [PATCH] added timeout when waiting for docker pidfile Docker-DCO-1.1-Signed-off-by: Chris St. Pierre (github: stpierre) --- contrib/init/sysvinit-redhat/docker | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/contrib/init/sysvinit-redhat/docker b/contrib/init/sysvinit-redhat/docker index 7d056aacad..06699f6ab1 100755 --- a/contrib/init/sysvinit-redhat/docker +++ b/contrib/init/sysvinit-redhat/docker @@ -3,7 +3,7 @@ # /etc/rc.d/init.d/docker # # Daemon for docker.io -# +# # chkconfig: 2345 95 95 # description: Daemon for docker.io @@ -49,10 +49,12 @@ start() { $exec -d $other_args &>> $logfile & pid=$! touch $lockfile - # wait for the pidfile to exist. see + # wait up to 10 seconds for the pidfile to exist. see # https://github.com/dotcloud/docker/issues/5359 - while [ ! -f $pidfile ]; do + tries=0 + while [ ! -f $pidfile -a $tries -lt 10 ]; do sleep 1 + tries=$((tries + 1)) done success echo