v-insert-dns-records 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/bash
  2. # info: inserts dns records
  3. # options: USER DOMAIN DATA_FILE
  4. #
  5. # The function copy dns record to the domain conf
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument defenition
  10. user=$1
  11. domain=$2
  12. data_file=$3
  13. # Includes
  14. source $VESTA/conf/vesta.conf
  15. source $VESTA/func/main.sh
  16. #----------------------------------------------------------#
  17. # Verifications #
  18. #----------------------------------------------------------#
  19. check_args '3' "$#" 'USER DOMAIN DATAFILE'
  20. validate_format 'user' 'domain' 'data_file'
  21. is_system_enabled "$DNS_SYSTEM"
  22. is_object_valid 'user' 'USER' "$user"
  23. is_object_unsuspended 'user' 'USER' "$user"
  24. is_object_valid 'dns' 'DOMAIN' "$domain"
  25. #----------------------------------------------------------#
  26. # Action #
  27. #----------------------------------------------------------#
  28. # Insert values
  29. if [ -e "$data_file" ]; then
  30. mv -f $data_file $USER_DATA/dns/$domain.conf
  31. chmod 660 $USER_DATA/dns/$domain.conf
  32. fi
  33. #----------------------------------------------------------#
  34. # Vesta #
  35. #----------------------------------------------------------#
  36. # Logging
  37. log_event "$OK" "$EVENT"
  38. exit