From a08ca14e3c0ebb00725a2cb5e9d21d060ca7cd6b Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 26 Mar 2013 15:40:29 -0400 Subject: [PATCH] cloud-init-nonet.conf: handle case where sleep died In starting containers in lxc, I was seeing errors like: /proc/self/fd/9: 24: kill: No such process Which indicated the sleep pid had already died. I'm not sure how or why it was dead, but this just is less annoying in that case. --- upstart/cloud-init-nonet.conf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/upstart/cloud-init-nonet.conf b/upstart/cloud-init-nonet.conf index 36b99fb5..a94b1474 100644 --- a/upstart/cloud-init-nonet.conf +++ b/upstart/cloud-init-nonet.conf @@ -31,7 +31,12 @@ script handle_sigterm() { # if we received sigterm and static networking is up then it probably # came from upstart as a result of 'stop on static-network-up' - [ -z "$SLEEP_CHILD" ] || kill $SLEEP_CHILD + if [ -n "$SLEEP_CHILD" ]; then + if ! kill $SLEEP_CHILD 2>/dev/null; then + [ ! -d "/proc/$SLEEP_CHILD" ] || + msg "hm.. failed to kill sleep pid $SLEEP_CHILD" + fi + fi if static_network_up; then msg "static networking is now up" exit 0