Last active
April 13, 2018 22:52
-
-
Save zach-adams/f511f062ea6b1dd7b6da to your computer and use it in GitHub Desktop.
A modified Vagrantfile to tell VVV to run import-sql script on up
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Vagrant Triggers | |
# | |
# If the vagrant-triggers plugin is installed, we can run various scripts on Vagrant | |
# state changes like `vagrant up`, `vagrant halt`, `vagrant suspend`, and `vagrant destroy` | |
# | |
# These scripts are run on the host machine, so we use `vagrant ssh` to tunnel back | |
# into the VM and execute things. By default, each of these scripts calls db_backup | |
# to create backups of all current databases. This can be overridden with custom | |
# scripting. See the individual files in config/homebin/ for details. | |
if defined? VagrantPlugins::Triggers | |
config.trigger.after :up, :stdout => true do | |
info "Importing databases..." | |
run_remote "bash /srv/database/sync-sql.sh" | |
end | |
config.trigger.before :halt, :stdout => true do | |
run "vagrant ssh -c 'vagrant_halt'" | |
end | |
config.trigger.before :suspend, :stdout => true do | |
run "vagrant ssh -c 'vagrant_suspend'" | |
end | |
config.trigger.before :destroy, :stdout => true do | |
run "vagrant ssh -c 'vagrant_destroy'" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment