aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-26 14:01:33 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-27 12:20:24 +0100
commit04de384256ad321834cf5e3dbb9a8d3ea2ab66c2 (patch)
tree3dbcf7e7a631c44b9d601a4bb1380890a430b0a5
parentdc1fcb61f7d89cd066ace2edc143e7a2d329e033 (diff)
downloadopenembedded-core-contrib-04de384256ad321834cf5e3dbb9a8d3ea2ab66c2.tar.gz
openembedded-core-contrib-04de384256ad321834cf5e3dbb9a8d3ea2ab66c2.tar.bz2
openembedded-core-contrib-04de384256ad321834cf5e3dbb9a8d3ea2ab66c2.zip
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@linuxfoundation.org>
-rw-r--r--meta/recipes-core/busybox/files/syslog22
1 files changed, 21 insertions, 1 deletions
diff --git a/meta/recipes-core/busybox/files/syslog b/meta/recipes-core/busybox/files/syslog
index 89c4d12e9c..49033c1755 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
;;
*)