On Fri, Nov 11, 2011 at 18:40, Harish Agarwal <har...@octopart.com> wrote:

> Hello,
>
> I'm using puppet via a bash script when I spin up a machine to configure
> it.  I'd like to restart the instance after puppet's run is complete.  In
> my bash script I have:
>
> puppet agent --test
> shutdown -r now
>
>
> Puppet runs to completion, but "shutdown -r now" never executes.  I'm not
> sure why not - these are the last two lines in my bash script and
> everything else executes successfully.  Any help would be greatly
> appreciated.
>
> -Harish
>
>
> Can you get the exit code of the puppet run and then, based on success or
failure, do the reboot?

puppet agent --test
ANSW=$?
if [[ ${ANSW} -eq 0 ]]
then
echo "Puppet successful - Exit code ${ANSW}"
/sbin/shutdown -r now
else
echo "No puppet run - Exit code ${ANSW}
fi

This may tell you if puppet is cancelling the shutdown...

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to