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 "----------------------------------------"
|
echo "----------------------------------------"
|
||||||
|
|
||||||
# Database name
|
# 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
|
# 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
|
# Derive WordPress content directories
|
||||||
UPLOADS_DIR="${WP_DIR}/wp-content/uploads"
|
UPLOADS_DIR="${WP_DIR}/wp-content/uploads"
|
||||||
|
@ -69,7 +79,12 @@ collect_variables() {
|
||||||
|
|
||||||
echo -e "\nBackup Locations:"
|
echo -e "\nBackup Locations:"
|
||||||
# Scripts directory
|
# 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 directory
|
||||||
BACKUP_DIR="${SCRIPTS_DIR}/backups"
|
BACKUP_DIR="${SCRIPTS_DIR}/backups"
|
||||||
|
@ -79,12 +94,29 @@ collect_variables() {
|
||||||
# S3cmd path
|
# S3cmd path
|
||||||
S3_CMD="/usr/local/bin/s3cmd"
|
S3_CMD="/usr/local/bin/s3cmd"
|
||||||
if [ ! -f "$S3_CMD" ]; then
|
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
|
fi
|
||||||
|
|
||||||
# S3 bucket information
|
# S3 bucket information
|
||||||
read -p "Enter S3 bucket name (e.g., my-bucket): " S3_BUCKET_NAME
|
while [ -z "$S3_BUCKET_NAME" ]; do
|
||||||
read -p "Enter S3 folder name (e.g., backups): " S3_FOLDER_NAME
|
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}/"
|
S3_BUCKET="s3://${S3_BUCKET_NAME}/${S3_FOLDER_NAME}/"
|
||||||
|
|
||||||
# Current date for backup naming
|
# Current date for backup naming
|
||||||
|
|
Loading…
Reference in a new issue