WordPress backup database with wp command

#!/bin/sh

/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
#!/bin/sh

wp db export - | gzip > ./db_backup-$(date +%Y-%m-%d-%H%M%S).sql.gz
#!/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

 

Leave a Reply

Your email address will not be published. Required fields are marked *