mirror of
https://github.com/myvesta/vesta.git
synced 2024-12-21 11:31:21 -08:00
50 lines
1.3 KiB
Bash
Executable File
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
|