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.
This commit is contained in:
Scott Moser 2013-03-26 15:40:29 -04:00
parent 92279d78c0
commit a08ca14e3c
1 changed files with 6 additions and 1 deletions

View File

@ -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