myvesta/bin/v-schedule-user-backup
2019-04-05 00:15:43 +02:00

50 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# info: schedule user backup creation
# options: USER
#
# The function for scheduling user backup creation.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
user=$1
# Includes
source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'USER'
is_format_valid 'user'
is_system_enabled "$BACKUP_SYSTEM" 'BACKUP_SYSTEM'
is_object_valid 'user' 'USER' "$user"
is_backup_enabled
is_backup_scheduled 'backup'
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Adding backup task to the queue
log=$VESTA/log/backup.log
echo "nice -n 19 ionice -c 3 $BIN/v-backup-user $user yes >> $log 2>&1" >>\
$VESTA/data/queue/backup.pipe
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$ARGUMENTS"
exit