v-restore-database 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. # shellcheck /usr/local/hestia/func/main.sh
  20. source $HESTIA/func/main.sh
  21. # shellcheck /usr/local/hestia/conf/hestia.conf
  22. source $HESTIA/conf/hestia.conf
  23. # Perform verification if read-only mode is enabled
  24. check_hestia_demo_mode
  25. #----------------------------------------------------------#
  26. # Verifications #
  27. #----------------------------------------------------------#
  28. args_usage='USER BACKUP DOMAIN [NOTIFY]'
  29. check_args '3' "$#" "$args_usage"
  30. is_format_valid 'user' 'backup'
  31. #----------------------------------------------------------#
  32. # Action #
  33. #----------------------------------------------------------#
  34. $BIN/v-restore-user $user $backup 'no' 'no' 'no' $database 'no' 'no' $notify
  35. #----------------------------------------------------------#
  36. # Hestia #
  37. #----------------------------------------------------------#
  38. log_event "$OK" "$ARGUMENTS"
  39. exit