1

I have a script that I've written that needs to run during shutdown which brings down my vagrant instance. The script runs without issue, and I echo output to stdout (and to a file) of the process.

The script outputs the following:

Shutting down vagrant
==> default: Attempting graceful shutdown of VM...
Vagrant shut down

However, when this runs from a computer shutdown (rc0) or reboot (rc6), the terminal logs the first two lines and then moves on without shutting down vagrant.

1 Answer 1

0

Add a call to the wait command after you halt vagrant. Something like this,

# Shutdown vagrant
vagrant halt
# wait for the halt
wait
3
  • Thanks Elliot. The issue was actually completely on my end. The rc calls are not asynchronous. I was echoing STDERR to a file. The vagrant halt command threw an exception as it couldn't read the $HOME variable. The exception was written to STDOUT. Removing the redirects, setting a dummy $HOME variable looks like it did the trick. Waiting to gain reputation points to post the answer.
    – eggmatters
    Apr 29, 2014 at 23:29
  • 1
    @eggmatters When you program any issues are very nearly always completely on your end. Apr 30, 2014 at 0:15
  • Yes, that is one of my programming axioms
    – eggmatters
    May 22, 2014 at 19:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .