Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dave-lw/14e50a0a5d1881726ef20eb054a56def to your computer and use it in GitHub Desktop.
Save dave-lw/14e50a0a5d1881726ef20eb054a56def to your computer and use it in GitHub Desktop.
PrestaShop full backup script
#!/bin/bash
#Main settings
DOMAIN_DIR="/path/to/your/public_html"
BACKUP_DIR="/path/to/your/backup"
DATE=$(date +%Y-%m-%d)
# MySQL Settings
DB_HOST="localhost"
DB_USER="mysql_username"
DB_PASS="mysql_username_password"
DB_NAME="mysql_database"
[ ! -d "$BACKUP_DIR" ] && mkdir -p $BACKUP_DIR
# MySQL Backup
mysqldump -u $DB_USER --password=$DB_PASS --opt --databases $DB_NAME | gzip -9 >${BACKUP_DIR}/${DATE}_backup.sql.gz
#Files Backup
tar cfzP - $DOMAIN_DIR >${BACKUP_DIR}/${DATE}_backup.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment