diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-06-26 14:01:33 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-06-27 12:20:36 +0100 |
commit | 91144160e1770d07994670b8b97274d1f96ed05f (patch) | |
tree | ae33d81d49c8220841d77fb8ab65d32004f771be /meta/recipes-core | |
parent | a06a47af305d44212c3aa1fb936cfdfe22848d20 (diff) | |
download | poky-91144160e1770d07994670b8b97274d1f96ed05f.tar.gz |
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.
(From OE-Core rev: 04de384256ad321834cf5e3dbb9a8d3ea2ab66c2)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r-- | meta/recipes-core/busybox/files/syslog | 22 |
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 | |||
51 | SYSLOG_ARGS="-C" | 51 | SYSLOG_ARGS="-C" |
52 | fi | 52 | fi |
53 | 53 | ||
54 | waitpid () | ||
55 | { | ||
56 | pid=$1 | ||
57 | # Give pid a chance to exit before we restart with a 5s timeout in 1s intervals | ||
58 | if [ -z "$pid" ]; then | ||
59 | return | ||
60 | fi | ||
61 | timeout=5; | ||
62 | while [ $timeout -gt 0 ] | ||
63 | do | ||
64 | timeout=$(( $timeout-1 )) | ||
65 | kill -0 $pid 2> /dev/null || break | ||
66 | sleep 1 | ||
67 | done | ||
68 | } | ||
69 | |||
54 | case "$1" in | 70 | case "$1" in |
55 | start) | 71 | start) |
56 | echo -n "Starting syslogd/klogd: " | 72 | echo -n "Starting syslogd/klogd: " |
@@ -65,7 +81,11 @@ case "$1" in | |||
65 | echo "done" | 81 | echo "done" |
66 | ;; | 82 | ;; |
67 | restart) | 83 | restart) |
68 | $0 stop | 84 | pid1=`pidof syslogd` |
85 | pid2=`pidof syslogd` | ||
86 | $0 stop | ||
87 | waitpid $pid1 | ||
88 | waitpid $pid2 | ||
69 | $0 start | 89 | $0 start |
70 | ;; | 90 | ;; |
71 | *) | 91 | *) |