v-restore-database 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. # info: restore single database
  3. # options: USER BACKUP DOMAIN [NOTIFY]
  4. # labels: panel
  5. #
  6. # example: v-restore-web-domain USER BACKUP DATABASE [NOTIFY]
  7. #
  8. # The function allows the user to restore a single database
  9. # from a backup archive.
  10. #----------------------------------------------------------#
  11. # Variable&Function #
  12. #----------------------------------------------------------#
  13. # Argument definition
  14. user=$1
  15. backup=$2
  16. database=$3
  17. notify=$4
  18. # Includes
  19. source $HESTIA/func/main.sh
  20. source $HESTIA/conf/hestia.conf
  21. # Perform verification if read-only mode is enabled
  22. check_hestia_demo_mode
  23. #----------------------------------------------------------#
  24. # Verifications #
  25. #----------------------------------------------------------#
  26. args_usage='USER BACKUP DOMAIN [NOTIFY]'
  27. check_args '3' "$#" "$args_usage"
  28. is_format_valid 'user' 'backup'
  29. #----------------------------------------------------------#
  30. # Action #
  31. #----------------------------------------------------------#
  32. $BIN/v-restore-user $user $backup 'no' 'no' 'no' $database 'no' 'no' $notify
  33. #----------------------------------------------------------#
  34. # Hestia #
  35. #----------------------------------------------------------#
  36. log_event "$OK" "$ARGUMENTS"
  37. exit