mirror of
https://github.com/uprightbass360/AzerothCore-RealmMaster.git
synced 2026-02-17 17:14:34 +00:00
fix: update import/export to use params
This commit is contained in:
@@ -2,17 +2,17 @@
|
||||
# Export auth and character databases to ExportBackup_<timestamp>/
|
||||
set -euo pipefail
|
||||
|
||||
MYSQL_PW="${MYSQL_ROOT_PASSWORD}"
|
||||
DB_AUTH="${DB_AUTH_NAME}"
|
||||
DB_CHAR="${DB_CHARACTERS_NAME}"
|
||||
|
||||
usage(){
|
||||
cat <<EOF
|
||||
Usage: ./backup-export.sh [output_dir]
|
||||
Usage: ./backup-export.sh [output_dir] <mysql_password> <auth_db> <characters_db>
|
||||
|
||||
Creates a timestamped backup of the auth and character databases.
|
||||
If output_dir is provided, places the timestamped folder inside it
|
||||
(default: .).
|
||||
|
||||
Arguments:
|
||||
[output_dir] Output directory (default: .)
|
||||
<mysql_password> MySQL root password (required)
|
||||
<auth_db> Auth database name (required)
|
||||
<characters_db> Characters database name (required)
|
||||
|
||||
Outputs:
|
||||
ExportBackup_YYYYMMDD_HHMMSS/
|
||||
@@ -28,6 +28,26 @@ case "${1:-}" in
|
||||
-h|--help) usage; exit 0;;
|
||||
esac
|
||||
|
||||
MYSQL_PW="$2"
|
||||
DB_AUTH="$3"
|
||||
DB_CHAR="$4"
|
||||
|
||||
# Check if required parameters are provided
|
||||
if [[ -z "$MYSQL_PW" ]]; then
|
||||
echo "Error: MySQL password required as second argument." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$DB_AUTH" ]]; then
|
||||
echo "Error: Auth database name required as third argument." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$DB_CHAR" ]]; then
|
||||
echo "Error: Characters database name required as fourth argument." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DEST_PARENT="${1:-.}"
|
||||
TIMESTAMP="$(date +%Y%m%d_%H%M%S)"
|
||||
DEST_DIR="${DEST_PARENT%/}/ExportBackup_${TIMESTAMP}"
|
||||
|
||||
Reference in New Issue
Block a user