Skip to content

Instantly share code, notes, and snippets.

@inspiredearth
Forked from hofmannsven/README.md
Last active October 13, 2021 12:40
Show Gist options
  • Select an option

  • Save inspiredearth/783b0cb68b10a20872a1f7017d9a9dea to your computer and use it in GitHub Desktop.

Select an option

Save inspiredearth/783b0cb68b10a20872a1f7017d9a9dea to your computer and use it in GitHub Desktop.

Revisions

  1. Jonathan E revised this gist Aug 18, 2018. 2 changed files with 7 additions and 3 deletions.
    5 changes: 3 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    WordPress Backups with WP-CLI
    WordPress Backups with WP-CLI and TAR
    ===============

    Related tutorial: https://code64.de/visionerdy/wordpress-backups/
    The paths used may be server specific. Adjust accordinarly.
    Simple commands and bash scripts useful for quick backups of Wordpress.
    5 changes: 4 additions & 1 deletion backup_pre-update.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,7 @@
    #!/bin/sh
    tar -czf ~/wp-backups/plugins-$(date +%Y-%m-%d-%H%M%S).tar.gz ~/httpdocs/wp-content/plugins
    echo "Plugins backed up. Now doing themes."
    tar -czf ~/wp-backups/themes-$(date +%Y-%m-%d-%H%M%S).tar.gz ~/httpdocs/wp-content/themes
    wp db export - | gzip > ~/wp-backups/db_backup-$(date +%Y-%m-%d-%H%M%S).sql.gz
    echo "Themes backed up. Now doing database."
    wp db export - | gzip > ~/wp-backups/db_backup-$(date +%Y-%m-%d-%H%M%S).sql.gz
    echo "Database backed up"
  2. Jonathan E revised this gist Aug 18, 2018. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions backup_pre-update.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    #!/bin/sh
    tar -czf ~/wp-backups/plugins-$(date +%Y-%m-%d-%H%M%S).tar.gz ~/httpdocs/wp-content/plugins
    tar -czf ~/wp-backups/themes-$(date +%Y-%m-%d-%H%M%S).tar.gz ~/httpdocs/wp-content/themes
    wp db export - | gzip > ~/wp-backups/db_backup-$(date +%Y-%m-%d-%H%M%S).sql.gz
  3. @hofmannsven hofmannsven revised this gist Oct 22, 2015. No changes.
  4. @hofmannsven hofmannsven revised this gist Oct 22, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    WordPress Backups
    WordPress Backups with WP-CLI
    ===============

    Blogpost: https://code64.de/visionerdy/wordpress-backups/
    Related tutorial: https://code64.de/visionerdy/wordpress-backups/
  5. @hofmannsven hofmannsven revised this gist Oct 22, 2015. No changes.
  6. @hofmannsven hofmannsven revised this gist Oct 22, 2015. 3 changed files with 7 additions and 0 deletions.
    1 change: 1 addition & 0 deletions crontab
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    30 18 * * * sh /var/www/backups/backup.sh > /var/www/logs/cronlog 2>&1
    3 changes: 3 additions & 0 deletions db_backup.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    #!/bin/sh

    wp db export - | gzip > ./db_backup-$(date +%Y-%m-%d-%H%M%S).sql.gz
    3 changes: 3 additions & 0 deletions wp_backup.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    #!/bin/sh

    tar --create --gzip --verbose --absolute-names --file=./wp_backup-$(date +%Y-%m-%d-%H%M%S).tar.gz --exclude=*.tar.gz /var/www/websites/wp
  7. @hofmannsven hofmannsven revised this gist Oct 22, 2015. 2 changed files with 5 additions and 3 deletions.
    4 changes: 3 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,4 @@
    TODO
    WordPress Backups
    ===============

    Blogpost: https://code64.de/visionerdy/wordpress-backups/
    4 changes: 2 additions & 2 deletions backup.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    #!/bin/sh

    /usr/local/bin/wp db --path=/vagrant/www/wpse --allow-root export - | gzip > /vagrant/www/backups/db_backup-$(date +%Y-%m-%d-%H%M%S).sql.gz &
    tar --create --gzip --absolute-names --file=/vagrant/www/backups/wp_backup-$(date +%Y-%m-%d-%H%M%S).tar.gz --exclude=*.tar.gz /vagrant/www/wpse
    /usr/local/bin/wp db --path=/var/www/websites/wp - | gzip > /var/www/backups/db_backup-$(date +%Y-%m-%d-%H%M%S).sql.gz &
    tar --create --gzip --absolute-names --file=/var/www/backups/wp_backup-$(date +%Y-%m-%d-%H%M%S).tar.gz --exclude=*.tar.gz /var/www/websites/wp
  8. @hofmannsven hofmannsven created this gist Oct 22, 2015.
    2 changes: 2 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    TODO
    ===============
    4 changes: 4 additions & 0 deletions backup.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    #!/bin/sh

    /usr/local/bin/wp db --path=/vagrant/www/wpse --allow-root export - | gzip > /vagrant/www/backups/db_backup-$(date +%Y-%m-%d-%H%M%S).sql.gz &
    tar --create --gzip --absolute-names --file=/vagrant/www/backups/wp_backup-$(date +%Y-%m-%d-%H%M%S).tar.gz --exclude=*.tar.gz /vagrant/www/wpse