update
This commit is contained in:
parent
b91962fc2e
commit
7328f25e68
1 changed files with 38 additions and 6 deletions
|
@ -56,10 +56,20 @@ collect_variables() {
|
|||
echo "----------------------------------------"
|
||||
|
||||
# Database name
|
||||
read -p "Enter database name: " DATABASE
|
||||
while [ -z "$DATABASE" ]; do
|
||||
read -r -p "Enter database name: " DATABASE
|
||||
if [ -z "$DATABASE" ]; then
|
||||
echo "Database name cannot be empty. Please try again."
|
||||
fi
|
||||
done
|
||||
|
||||
# WordPress directory
|
||||
read -p "Enter WordPress installation path (e.g., /home/username/htdocs/domain.com): " WP_DIR
|
||||
while [ -z "$WP_DIR" ]; do
|
||||
read -r -p "Enter WordPress installation path (e.g., /home/username/htdocs/domain.com): " WP_DIR
|
||||
if [ -z "$WP_DIR" ]; then
|
||||
echo "WordPress path cannot be empty. Please try again."
|
||||
fi
|
||||
done
|
||||
|
||||
# Derive WordPress content directories
|
||||
UPLOADS_DIR="${WP_DIR}/wp-content/uploads"
|
||||
|
@ -69,7 +79,12 @@ collect_variables() {
|
|||
|
||||
echo -e "\nBackup Locations:"
|
||||
# Scripts directory
|
||||
read -p "Enter scripts directory path (e.g., /home/username/scripts): " SCRIPTS_DIR
|
||||
while [ -z "$SCRIPTS_DIR" ]; do
|
||||
read -r -p "Enter scripts directory path (e.g., /home/username/scripts): " SCRIPTS_DIR
|
||||
if [ -z "$SCRIPTS_DIR" ]; then
|
||||
echo "Scripts directory path cannot be empty. Please try again."
|
||||
fi
|
||||
done
|
||||
|
||||
# Backup directory
|
||||
BACKUP_DIR="${SCRIPTS_DIR}/backups"
|
||||
|
@ -79,12 +94,29 @@ collect_variables() {
|
|||
# S3cmd path
|
||||
S3_CMD="/usr/local/bin/s3cmd"
|
||||
if [ ! -f "$S3_CMD" ]; then
|
||||
read -p "s3cmd not found at default location. Enter s3cmd path: " S3_CMD
|
||||
while [ ! -f "$S3_CMD" ]; do
|
||||
read -r -p "s3cmd not found at default location. Enter s3cmd path: " S3_CMD
|
||||
if [ ! -f "$S3_CMD" ]; then
|
||||
echo "Invalid path. File does not exist. Please try again."
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# S3 bucket information
|
||||
read -p "Enter S3 bucket name (e.g., my-bucket): " S3_BUCKET_NAME
|
||||
read -p "Enter S3 folder name (e.g., backups): " S3_FOLDER_NAME
|
||||
while [ -z "$S3_BUCKET_NAME" ]; do
|
||||
read -r -p "Enter S3 bucket name (e.g., my-bucket): " S3_BUCKET_NAME
|
||||
if [ -z "$S3_BUCKET_NAME" ]; then
|
||||
echo "S3 bucket name cannot be empty. Please try again."
|
||||
fi
|
||||
done
|
||||
|
||||
while [ -z "$S3_FOLDER_NAME" ]; do
|
||||
read -r -p "Enter S3 folder name (e.g., backups): " S3_FOLDER_NAME
|
||||
if [ -z "$S3_FOLDER_NAME" ]; then
|
||||
echo "S3 folder name cannot be empty. Please try again."
|
||||
fi
|
||||
done
|
||||
|
||||
S3_BUCKET="s3://${S3_BUCKET_NAME}/${S3_FOLDER_NAME}/"
|
||||
|
||||
# Current date for backup naming
|
||||
|
|
Loading…
Reference in a new issue