[oe-commits] [openembedded-core] 01/02: busybox: Improve syslog restart handling

git at git.openembedded.org git at git.openembedded.org
Wed Jun 26 13:05:20 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 0349831a5cb9ee9892c0c7b380edebd90b2a3d8e
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Wed Jun 26 14:01:33 2019 +0100

    busybox: Improve syslog restart handling
    
    We're seeing races on the autobuilder where syslogd fails to shut down
    fast enough to be restarted leading to failures.
    
    Add some checks to ensure when restarting that processes exit before
    being restarted.
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/recipes-core/busybox/files/syslog | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-core/busybox/files/syslog b/meta/recipes-core/busybox/files/syslog
index 89c4d12..49033c1 100644
--- a/meta/recipes-core/busybox/files/syslog
+++ b/meta/recipes-core/busybox/files/syslog
@@ -51,6 +51,22 @@ else
 	SYSLOG_ARGS="-C"
 fi
 
+waitpid ()
+{
+  pid=$1
+  # Give pid a chance to exit before we restart with a 5s timeout in 1s intervals
+  if [ -z "$pid" ]; then
+    return
+  fi
+  timeout=5;
+  while [ $timeout -gt 0 ]
+  do
+    timeout=$(( $timeout-1 ))
+    kill -0 $pid 2> /dev/null || break
+    sleep 1
+  done
+}
+
 case "$1" in
   start)
 	echo -n "Starting syslogd/klogd: "
@@ -65,7 +81,11 @@ case "$1" in
 	echo "done"
 	;;
   restart)
-  	$0 stop
+	pid1=`pidof syslogd`
+	pid2=`pidof syslogd`
+	$0 stop
+	waitpid $pid1
+	waitpid $pid2
 	$0 start
 	;;
   *)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list