v-unsuspend-domain 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/bin/bash
  2. # info: unsuspend web/dns/mail domain
  3. # options: USER DOMAIN
  4. #
  5. # The function unsuspends web/dns/mail domain.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument definition
  10. user=$1
  11. domain=$2
  12. restart="${3-yes}"
  13. # Includes
  14. source $VESTA/func/main.sh
  15. source $VESTA/conf/vesta.conf
  16. #----------------------------------------------------------#
  17. # Verifications #
  18. #----------------------------------------------------------#
  19. check_args '2' "$#" 'USER DOMAIN'
  20. is_format_valid 'user' 'domain'
  21. is_object_valid 'user' 'USER' "$user"
  22. #----------------------------------------------------------#
  23. # Action #
  24. #----------------------------------------------------------#
  25. # Working on Web domain
  26. if [ ! -z "$WEB_SYSTEM" ]; then
  27. str=$(grep "DOMAIN='$domain'" $USER_DATA/web.conf |grep "SUSPENDED='yes")
  28. if [ ! -z "$str" ]; then
  29. domain_found='yes'
  30. $BIN/v-unsuspend-web-domain $user $domain 'no'
  31. check_result $? "can't suspend web" > /dev/null
  32. fi
  33. fi
  34. # Working on DNS domain
  35. if [ ! -z "$DNS_SYSTEM" ]; then
  36. str=$(grep "DOMAIN='$domain'" $USER_DATA/dns.conf |grep "SUSPENDED='yes")
  37. if [ ! -z "$str" ]; then
  38. domain_found='yes'
  39. $BIN/v-unsuspend-dns-domain $user $domain 'no'
  40. check_result $? "can't suspend dns" > /dev/null
  41. fi
  42. fi
  43. # Working on Mail domain
  44. if [ ! -z "$MAIL_SYSTEM" ]; then
  45. str=$(grep "DOMAIN='$domain'" $USER_DATA/mail.conf |grep "SUSPENDED='yes")
  46. if [ ! -z "$str" ]; then
  47. domain_found='yes'
  48. $BIN/v-unsuspend-mail-domain $user $domain
  49. check_result $? "can't suspend mail" > /dev/null
  50. fi
  51. fi
  52. # Checking domain search result
  53. if [ -z "$domain_found" ]; then
  54. echo "Error: domain $domain doesn't exist"
  55. log_event "$E_NOTEXIST" "$ARGUMENTS"
  56. exit $E_NOTEXIST
  57. fi
  58. # Restarting services
  59. if [ "$restart" != 'no' ]; then
  60. $BIN/v-restart-web
  61. check_result $? "can't restart web" > /dev/null
  62. if [ ! -z "$PROXY_SYSTEM" ]; then
  63. $BIN/v-restart-proxy
  64. check_result $? "can't restart proxy" > /dev/null
  65. fi
  66. $BIN/v-restart-dns
  67. check_result $? "can't restart dns" > /dev/null
  68. fi
  69. #----------------------------------------------------------#
  70. # Vesta #
  71. #----------------------------------------------------------#
  72. exit