yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #00256
[Bug 1064665] Re: should have some way to indicate shutdown or reboot
** Changed in: cloud-init
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1064665
Title:
should have some way to indicate shutdown or reboot
Status in Init scripts for use on cloud images:
Fix Released
Bug description:
At [1], I put in place change like below as a way to shut down cleanly, and
avoid the annoying messages cloud-init spews if you run /sbin/poweroff from
inside a user-data script.
Basically, at the end of my user-data I would do something like this:
# delay the poweroff to avoid annoying cloud-init messages
sh -fc 'i=0; while [ $i -lt 30 ] && i=$(($i+1)); do
state=$(status cloud-final);
set -- $state
case "$2" in
stop/*) poweroff; exit 0;;
esac
echo "$state [$2] after $i"
sleep 1
done
echo "giving up after 30 seconds"
poweroff' </dev/null &
That actually works fine, but its a bit more involved than it should be.
I can think of 2 ways to somewhat cleanly expose this:
cloud-init request-poweroff [type [delay]]
where 'type' would be 'reboot', 'poweroff' ...
and cloud-init would somehow handle making that happen "delay" seconds after
it finished cloud-final.
Secondly, it'd be nice to have that as a cloud-config option also.
#cloud-config
shutdown: reboot 30
request-poweroff could just put a marker file in /run that would be read when
cloud-final finished.
[1] https://code.launchpad.net/~smoser/maas/cleaner-
shutdown/+merge/128807
To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1064665/+subscriptions