2019-12-19 21:50:50 -08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-01-02 17:26:55 -08:00
|
|
|
BACKUPDIR="/home/mab/databaseBackupPi"
|
2019-12-19 21:50:50 -08:00
|
|
|
|
|
|
|
mkdir -p $BACKUPDIR
|
|
|
|
cd $BACKUPDIR
|
|
|
|
|
|
|
|
NOW=$(date +"%Y-%m-%d_%H-%M")
|
2020-03-25 21:45:23 -07:00
|
|
|
ssh mab@solidscribe.com -p 13328 "mysqldump --all-databases --user root -pRootPass1234!" > "backup-$NOW.sql"
|
2019-12-19 21:50:50 -08:00
|
|
|
|
|
|
|
cp "backup-$NOW.sql" "/mnt/Windows Data/DatabaseBackups/backup-$NOW.sql"
|
|
|
|
|
2020-01-02 17:26:55 -08:00
|
|
|
echo "Database Backup Complete on $NOW"
|
2019-12-19 21:50:50 -08:00
|
|
|
|
|
|
|
#Restore DB
|
|
|
|
# copy file over, run restore
|
|
|
|
# scp -P 13328 backup-2019-12-04_03-00.sql mab@avidhabit.com:/home/mab
|
2020-01-02 17:26:55 -08:00
|
|
|
# mysql -u root -p < backup-2019-12-04_03-00.sql
|