Skip to content

Instantly share code, notes, and snippets.

@Remiz
Remiz / local_sync.sh
Created Nov 6, 2020
mysql sync script
View local_sync.sh
#!/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 .
View gist:5c8123eda2853980c752a3cd16fdbe03
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