Skip to content

Instantly share code, notes, and snippets.

@Remiz
Remiz / local_sync.sh
Created November 6, 2020 23:46
mysql sync script
#!/bin/bash
if [ "$HOSTNAME" = "prod-server-name" ]; then
echo 'DO NOT RUN ON PRODUCTION!'
exit
fi
# Create backup / transfer it
ssh user@prod-server-name 'mysqldump --single-transaction -u www -ppassword database | gzip > database.sql.gz'
scp user@prod-server-name:/home/user/database.sql.gz .
Vagrant.configure(2) do |config|
config.vm.box = 'bento/ubuntu-16.04'
config.vm.define "project"
config.vm.hostname = "boxname"
config.vm.network "forwarded_port", guest: 8000, host: 8000
config.ssh.forward_agent = true
# Syncing using NFS and shorten cache life for faster reload