Created
December 11, 2023 10:11
-
-
Save cubuspl42/cb8da9963c542b3ea31d34c5a9fdaa16 to your computer and use it in GitHub Desktop.
Revisions
-
cubuspl42 created this gist
Dec 11, 2023 .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,17 @@ #!/usr/bin/env bash set -ex [ -n "$1" ] || exit 1 cd /var/www SHOP_NAME=$1 DB_CREDENTIALS=$( php <<PHP <?php require '$SHOP_NAME/config/settings.inc.php'; print(_DB_USER_ . ' ' . _DB_PASSWD_ . ' ' . _DB_NAME_ . PHP_EOL); ?> PHP ) read DB_USER DB_PASSWD DB_NAME <<< $DB_CREDENTIALS mysqldump -u $DB_USER -p$DB_PASSWD $DB_NAME > $SHOP_NAME/$DB_NAME.sql 7z -xr!backup -xr!backups -xr!cache a "$HOME/backup/$SHOP_NAME-backup-$(date +%F-%T).7z" $(realpath "$SHOP_NAME") rm $SHOP_NAME/$DB_NAME.sql