v-change-sys-ip-name 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. # info: change ip name
  3. # options: IP NAME
  4. #
  5. # The function for changing dns domain associated with ip.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument definition
  10. ip=$1
  11. ip_name=$2
  12. # Includes
  13. source $VESTA/func/main.sh
  14. source $VESTA/func/ip.sh
  15. source $VESTA/conf/vesta.conf
  16. #----------------------------------------------------------#
  17. # Verifications #
  18. #----------------------------------------------------------#
  19. check_args '2' "$#" 'IP IP_NAME'
  20. is_format_valid 'ip'
  21. is_format_valid 'ip_name'
  22. is_ip_valid "$ip"
  23. #----------------------------------------------------------#
  24. # Action #
  25. #----------------------------------------------------------#
  26. # Changing ip name
  27. update_ip_value '$NAME' "$ip_name"
  28. #----------------------------------------------------------#
  29. # Vesta #
  30. #----------------------------------------------------------#
  31. # Logging
  32. log_history "changed associated dns on $ip to $domain" '' 'admin'
  33. log_event "$OK" "$ARGUMENTS"
  34. exit