add --chown option
This commit is contained in:
parent
38b79e6929
commit
a133f4de51
@ -62,6 +62,12 @@ do_backup() {
|
|||||||
|
|
||||||
save_environment_info "$backup_dir"
|
save_environment_info "$backup_dir"
|
||||||
|
|
||||||
|
# change ownership of backup directory if requested
|
||||||
|
if [ -n "$CHOWN_USER" ]; then
|
||||||
|
info "Changing ownership of backup directory to $CHOWN_USER"
|
||||||
|
chown -R "$CHOWN_USER" "$backup_dir"
|
||||||
|
fi
|
||||||
|
|
||||||
info "Backup completed successfully"
|
info "Backup completed successfully"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,9 +150,11 @@ OPTIONS:
|
|||||||
-t, --threads <num> Number of parallel threads (default: 4)
|
-t, --threads <num> Number of parallel threads (default: 4)
|
||||||
-c, --compress <0|1> Enable/disable backup compression (default: 1)
|
-c, --compress <0|1> Enable/disable backup compression (default: 1)
|
||||||
-e, --extra-options <str> Additional options to pass to mariabackup
|
-e, --extra-options <str> Additional options to pass to mariabackup
|
||||||
|
--chown <user:group> Change ownership of backup directory to user:group
|
||||||
|
|
||||||
EXAMPLES:
|
EXAMPLES:
|
||||||
$0 -u backupuser -p secret -d /backups backup
|
$0 -u backupuser -p secret -d /backups backup
|
||||||
|
$0 -u backupuser -p secret -d /backups --chown mysql:mysql backup
|
||||||
$0 prepare /backups/20240101_120000
|
$0 prepare /backups/20240101_120000
|
||||||
$0 restore /backups/20240101_120000
|
$0 restore /backups/20240101_120000
|
||||||
$0 -u backupuser -p secret grants
|
$0 -u backupuser -p secret grants
|
||||||
@ -162,6 +170,7 @@ MAX_BACKUPS=3
|
|||||||
PARALLEL_THREADS=4
|
PARALLEL_THREADS=4
|
||||||
COMPRESS=1
|
COMPRESS=1
|
||||||
EXTRA_OPTIONS=
|
EXTRA_OPTIONS=
|
||||||
|
CHOWN_USER=
|
||||||
WORK_DIR=
|
WORK_DIR=
|
||||||
COMMAND=
|
COMMAND=
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
@ -173,6 +182,7 @@ while [ $# -gt 0 ]; do
|
|||||||
-t|--threads) PARALLEL_THREADS="$2"; shift ;;
|
-t|--threads) PARALLEL_THREADS="$2"; shift ;;
|
||||||
-c|--compress) COMPRESS="$2"; shift ;;
|
-c|--compress) COMPRESS="$2"; shift ;;
|
||||||
-e|--extra-options) EXTRA_OPTIONS="$2"; shift ;;
|
-e|--extra-options) EXTRA_OPTIONS="$2"; shift ;;
|
||||||
|
--chown) CHOWN_USER="$2"; shift ;;
|
||||||
-h|--help) COMMAND=help ;;
|
-h|--help) COMMAND=help ;;
|
||||||
backup|grants|help) COMMAND="$1" ;;
|
backup|grants|help) COMMAND="$1" ;;
|
||||||
prepare|restore)
|
prepare|restore)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user