You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.9 KiB
63 lines
1.9 KiB
#!/bin/bash
|
|
# info: schedule user backup restoration
|
|
# options: USER BACKUP [WEB] [DNS] [MAIL] [DB] [CRON] [UDIR]
|
|
#
|
|
# example: v-schedule-user-restore 2019-04-22_01-00-00.tar
|
|
#
|
|
# This function for scheduling user backup restoration.
|
|
|
|
#----------------------------------------------------------#
|
|
# Variables & Functions #
|
|
#----------------------------------------------------------#
|
|
|
|
# Argument definition
|
|
user=$1
|
|
backup=$2
|
|
web=$3
|
|
dns=$4
|
|
mail=$5
|
|
db=$6
|
|
cron=$7
|
|
udir=$8
|
|
|
|
# Includes
|
|
# shellcheck source=/etc/hestiacp/hestia.conf
|
|
source /etc/hestiacp/hestia.conf
|
|
# shellcheck source=/usr/local/hestia/func/main.sh
|
|
source $HESTIA/func/main.sh
|
|
# load config file
|
|
source_conf "$HESTIA/conf/hestia.conf"
|
|
|
|
#----------------------------------------------------------#
|
|
# Verifications #
|
|
#----------------------------------------------------------#
|
|
|
|
check_args '2' "$#" 'USER BACKUP [WEB] [DNS] [MAIL] [DB] [CRON] [UDIR]'
|
|
is_format_valid 'user'
|
|
is_system_enabled "$BACKUP_SYSTEM" 'BACKUP_SYSTEM'
|
|
is_object_valid 'user' 'USER' "$user"
|
|
is_backup_enabled
|
|
is_backup_scheduled 'restore'
|
|
|
|
# Perform verification if read-only mode is enabled
|
|
check_hestia_demo_mode
|
|
|
|
#----------------------------------------------------------#
|
|
# Action #
|
|
#----------------------------------------------------------#
|
|
|
|
# Adding restore task to the queue
|
|
log=$HESTIA/log/restore.log
|
|
options="'$web' '$dns' '$mail' '$db' '$cron' '$udir'"
|
|
echo "$BIN/v-restore-user $user $backup $options yes >> $log 2>&1" >> $HESTIA/data/queue/backup.pipe
|
|
|
|
#----------------------------------------------------------#
|
|
# Hestia #
|
|
#----------------------------------------------------------#
|
|
|
|
# Logging
|
|
$BIN/v-log-action "system" "Info" "Backup" "Restore of backup archive requested (User: $user, Archive: $backup)."
|
|
log_event "$OK" "$ARGUMENTS"
|
|
|
|
exit
|