v-change-sys-ip-name 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 defenition
  10. ip=$1
  11. ip_name=$2
  12. # Includes
  13. source $VESTA/conf/vesta.conf
  14. source $VESTA/func/main.sh
  15. source $VESTA/func/ip.sh
  16. #----------------------------------------------------------#
  17. # Verifications #
  18. #----------------------------------------------------------#
  19. check_args '2' "$#" 'IP IP_NAME'
  20. validate_format 'ip'
  21. if [ ! -z "$ip_name" ]; then
  22. validate_format 'ip_name'
  23. fi
  24. is_ip_valid
  25. #----------------------------------------------------------#
  26. # Action #
  27. #----------------------------------------------------------#
  28. # Changing ip name
  29. update_ip_value '$NAME' "$ip_name"
  30. #----------------------------------------------------------#
  31. # Vesta #
  32. #----------------------------------------------------------#
  33. # Logging
  34. log_history "changed associated dns on $ip to $domain" '' 'admin'
  35. log_event "$OK" "$EVENT"
  36. exit