the command will only check if the restart happened. if the command can be run, then will continue.
So you should separate your logic, from the restart and the command. - first command - restart - next command and in the next command do wait while that process is running or something. https://www.packer.io/docs/provisioners/windows-restart.html#restart_check_command On Wed, Dec 5, 2018 at 2:10 AM Subhashini Radhakrishnan <[email protected]> wrote: > While provisioning, I install a software which needs to complete a part of > installation on rebooting the machine. > > So after I run my powershell script to install the software, I issue > windows_restart with a restart check command. > > "provisioners": [ > { > "type": "powershell", > "elevated_user": "myuse", > "elevated_password": "{{ user `admin_pass` }}", > "script": "./scripts/install_software.ps1" > }, > { > "type": "windows-restart", > "restart_check_command": "powershell -command \"& {Get-Process | > Where-Object { $_ProcessName -ne 'msiexec' }}\"" > "restart_timeout": "30m" > }, > ] > > > So, I am asking packer to assume the restart is completed only when there > is no misexec process is running. After which I run some clean up scripts. > > my post installation step installs some drivers and it takes atleast 20 > mins to finish. > > but the instance gets terminated even before running the cleanupscripts. > Any clue? > > TIA > > -- > This mailing list is governed under the HashiCorp Community Guidelines - > https://www.hashicorp.com/community-guidelines.html. Behavior in > violation of those guidelines may result in your removal from this mailing > list. > > GitHub Issues: https://github.com/mitchellh/packer/issues > IRC: #packer-tool on Freenode > --- > You received this message because you are subscribed to the Google Groups > "Packer" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/packer-tool/43549505-00aa-46a9-b794-19275297aaeb%40googlegroups.com > <https://groups.google.com/d/msgid/packer-tool/43549505-00aa-46a9-b794-19275297aaeb%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Alvaro -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/mitchellh/packer/issues IRC: #packer-tool on Freenode --- You received this message because you are subscribed to the Google Groups "Packer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CAHqq0exOAH%3DxgBA1cj8Ky3GYTPgdZQqc-XG9SL5knE9Kw%2BacKQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
