Last active
August 23, 2016 21:00
-
-
Save rdlmda/04e67077dab15502dce8b7c9f21f8601 to your computer and use it in GitHub Desktop.
Revisions
-
Rudá Almeida revised this gist
Aug 23, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -19,6 +19,6 @@ scp /root/[filename].tar.bz2 webserver:~/backup/database/[filename]-${now}.tar. rm /root/[filename].sql rm /root/[filename].tar.bz2 rsync -varz /var/www/[wp-multisite-path]/wp-content/uploads/sites/$(wp site list --domain=[domain] --path=/var/www/[wp-multisite-path] --format=csv --allow-root | sed 1d)/ webserver:~/backup/uploads rsync -varz /var/www/[wp-multisite-path]/wp-content/plugins/ webserver:~/backup/plugins rsync -varz /var/www/[wp-multisite-path]/wp-content/themes/[theme-path]/ webserver:~/backup/tema -
Rudá Almeida created this gist
Aug 23, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ #!/bin/bash # A função deste script é realizar o backup do banco de dados e das pastas de um site isolado # de uma instalação WordPress Multisite, independente dos outros sites presentes na mesma # instalação. Para isso é utilizado o "wp db export", bem como o rsync das pastas com a ID # do site (hardcoded, no futuro melhorar isso). # # Este script deve ser colocado na máquina que hospeda o multisite e executado # periodicamente via cron. A máquina destino deve possuir as credenciais de acesso. # Prevents commands not being located when running in cron export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" now=$(date +"%Y-%m-%d_%H-%M-%S") wp db export /root/[filename].sql --path=/var/www/[wp-multisite-path] --tables=$(wp db tables --path=/var/www/[wp-multisite-path] --scope=blog --url=[site url] --format=csv --allow-root) --allow-root tar cvjf [filename].tar.bz2 [filename].sql scp /root/[filename].tar.bz2 webserver:~/backup/database/[filename]-${now}.tar.bz2 rm /root/[filename].sql rm /root/[filename].tar.bz2 rsync -varz /var/www/[wp-multisite-path]/wp-content/uploads/sites/[site-numeric-id]/ webserver:~/backup/uploads rsync -varz /var/www/[wp-multisite-path]/wp-content/plugins/ webserver:~/backup/plugins rsync -varz /var/www/[wp-multisite-path]/wp-content/themes/[theme-path]/ webserver:~/backup/tema