v-schedule-user-restore 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/bash
  2. # info: schedule user backup restoration
  3. # options: USER BACKUP [WEB] [DNS] [MAIL] [DB] [CRON] [UDIR]
  4. #
  5. # The function for scheduling user backup restoration.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument definition
  10. user=$1
  11. backup=$2
  12. web=$3
  13. dns=$4
  14. mail=$5
  15. db=$6
  16. cron=$7
  17. udir=$8
  18. # Includes
  19. source $VESTA/func/main.sh
  20. source $VESTA/conf/vesta.conf
  21. #----------------------------------------------------------#
  22. # Verifications #
  23. #----------------------------------------------------------#
  24. check_args '2' "$#" 'USER BACKUP [WEB] [DNS] [MAIL] [DB] [CRON] [UDIR]'
  25. is_format_valid 'user'
  26. is_system_enabled "$BACKUP_SYSTEM" 'BACKUP_SYSTEM'
  27. is_object_valid 'user' 'USER' "$user"
  28. is_backup_enabled
  29. is_backup_scheduled 'restore'
  30. #----------------------------------------------------------#
  31. # Action #
  32. #----------------------------------------------------------#
  33. # Adding restore task to the queue
  34. log=$VESTA/log/restore.log
  35. options="'$web' '$dns' '$mail' '$db' '$cron' '$udir'"
  36. echo "$BIN/v-restore-user $user $backup $options yes >> $log 2>&1" >>\
  37. $VESTA/data/queue/backup.pipe
  38. #----------------------------------------------------------#
  39. # Vesta #
  40. #----------------------------------------------------------#
  41. # Logging
  42. log_event "$OK" "$ARGUMENTS"
  43. exit