v-schedule-user-restore 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 defenition
  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/conf/vesta.conf
  20. source $VESTA/func/main.sh
  21. #----------------------------------------------------------#
  22. # Verifications #
  23. #----------------------------------------------------------#
  24. check_args '2' "$#" 'USER BACKUP [WEB] [DNS] [MAIL] [DB] [CRON] [UDIR]'
  25. validate_format 'user'
  26. is_system_enabled "$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. options="'$web' '$dns' '$mail' '$db' '$cron' '$udir'"
  35. echo "$BIN/v-restore-user $user $backup $options yes" \
  36. >> $VESTA/data/queue/backup.pipe
  37. #----------------------------------------------------------#
  38. # Vesta #
  39. #----------------------------------------------------------#
  40. # Logging
  41. log_event "$OK" "$EVENT"
  42. exit