Created
July 7, 2020 14:17
-
-
Save Mte90/167be9fedb4c133f66b546a3fd699ae3 to your computer and use it in GitHub Desktop.
Backup to webdav files and WordPress DB
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 | |
today=$(date +"%Y-%m-%d") | |
path=$(date +"%Y/%m/%d") | |
rm -rf ./backups | |
mkdir ./backups | |
tar --exclude='./public_html/cgi-bin' --exclude='*.zip' --exclude='./public_html/wp-content/cache' -zcvf ./backups/$today.tar.gz ./public_html > /dev/null | |
./wp db export --add-drop-table --path=./public_html/ - | gzip > "./backups/$today.sql.gz" | |
curl --user "user:pass" -T "./backups/$today.tar.gz" "https://domain.com/remote.php/webdav/folder/$path/domain-$today.tar.gz" | |
curl --user "user:pass" -T "./backups/$today.sql.gz" "https://domain.com/remote.php/webdav/folder/$path/domain-$today.sql.gz" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment