Created
August 21, 2019 16:54
-
-
Save teopost/f132019926947ac1f82aa364440e0b02 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/sh | |
#export filename=$(date +%Y%m%d-%H%M%S) | |
export filename=backup-website | |
if [ "$(id -u)" != "0" ]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
# Start backup | |
# -----------. | |
echo "Backup mysql..." | |
mysqldump -uroot -papice wpdb > /tmp/${filename}-mysql.sql | |
echo "Compress wordpress folder..." | |
cd /var/www/html && tar czf /tmp/${filename}-wp.tar.gz wordpress/ | |
# Start remote copy | |
# ----------------- | |
echo "Copy wordpress backup to nas01..." | |
scp /tmp/${filename}-wp.tar.gz [email protected]:/raid0/data/rilasci/Raspberry/raspb03-wp | |
echo "Copy mysql dump to nas01..." | |
scp /tmp/${filename}-mysql.sql [email protected]:/raid0/data/rilasci/Raspberry/raspb03-wp | |
# copia backup su wedoit remoto (cloudatcost) | |
echo "Copy wordpress backup to nas01..." | |
scp /tmp/${filename}-wp.tar.gz [email protected]:/home/user | |
echo "Copy mysql dump to nas01..." | |
scp /tmp/${filename}-mysql.sql [email protected]:/home/user | |
echo "Copy myself to nas01..." | |
scp ${0} [email protected]:/raid0/data/rilasci/Raspberry/raspb03-wp | |
# Finish | |
echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment