1
0
mirror of https://github.com/serghey-rodin/vesta.git synced 2025-03-11 12:22:56 -07:00
vesta/bin/v-schedule-user-restore

58 lines
1.5 KiB
Plaintext
Raw Normal View History

2013-01-19 23:07:26 +02:00
#!/bin/bash
2013-03-28 01:12:57 +02:00
# info: schedule user backup restoration
# options: USER BACKUP [WEB] [DNS] [MAIL] [DB] [CRON] [UDIR]
2013-01-19 23:07:26 +02:00
#
2013-03-28 01:12:57 +02:00
# The function for scheduling user backup restoration.
2013-01-19 23:07:26 +02:00
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
2015-11-06 17:38:58 +02:00
# Argument definition
2013-01-19 23:07:26 +02:00
user=$1
2013-03-28 01:12:57 +02:00
backup=$2
web=$3
dns=$4
mail=$5
db=$6
cron=$7
udir=$8
2013-01-19 23:07:26 +02:00
# Includes
source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf
2013-01-19 23:07:26 +02:00
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
2013-03-28 01:12:57 +02:00
check_args '2' "$#" 'USER BACKUP [WEB] [DNS] [MAIL] [DB] [CRON] [UDIR]'
is_format_valid 'user'
2013-05-29 13:16:09 +03:00
is_system_enabled "$BACKUP_SYSTEM" 'BACKUP_SYSTEM'
2013-01-19 23:07:26 +02:00
is_object_valid 'user' 'USER' "$user"
is_backup_enabled
2013-03-28 01:12:57 +02:00
is_backup_scheduled 'restore'
2013-01-19 23:07:26 +02:00
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
2013-03-28 01:12:57 +02:00
# Adding restore task to the queue
2013-10-21 17:47:10 +03:00
log=$VESTA/log/restore.log
2013-03-28 01:12:57 +02:00
options="'$web' '$dns' '$mail' '$db' '$cron' '$udir'"
2013-10-21 17:47:10 +03:00
echo "$BIN/v-restore-user $user $backup $options yes >> $log 2>&1" >>\
$VESTA/data/queue/backup.pipe
2013-01-19 23:07:26 +02:00
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$ARGUMENTS"
2013-01-19 23:07:26 +02:00
exit