From 0a950a7cdcf61e7abae3ecdbde4ea1a0fcddd53e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 16 Aug 2013 10:05:03 -0700 Subject: [PATCH] website: document handling reboots --- .../docs/provisioners/shell.html.markdown | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/website/source/docs/provisioners/shell.html.markdown b/website/source/docs/provisioners/shell.html.markdown index acb755818..a41ccb1b9 100644 --- a/website/source/docs/provisioners/shell.html.markdown +++ b/website/source/docs/provisioners/shell.html.markdown @@ -107,3 +107,23 @@ defines certain commonly useful environmental variables: * `PACKER_BUILDER_TYPE` is the type of the builder that was used to create the machine that the script is running on. This is useful if you want to run only certain parts of the script on systems built with certain builders. + +## Handling Reboots + +Provisioning sometimes involves restarts, usually when updating the operating +system. Packer is able to tolerate restarts via the shell provisioner. + +Packer handles this by retrying to start scripts for a period of time +before failing. This allows time for the machine to start up and be ready +to run scripts. The amount of time the provisioner will wait is configured +using `start_retry_timeout`, which defaults to a few minutes. + +Sometimes, when executing a command like `reboot`, the shell script will +return and Packer will start executing the next one before SSH actually +quits and the machine restarts. For this, put a long `sleep` after the +reboot so that SSH will eventually be killed automatically: + +``` +reboot +sleep 60 +```