v-change-sys-ip-name 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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' 'ip_name'
  21. is_ip_valid
  22. #----------------------------------------------------------#
  23. # Action #
  24. #----------------------------------------------------------#
  25. # Changing ip name
  26. update_ip_value '$NAME' "$ip_name"
  27. #----------------------------------------------------------#
  28. # Vesta #
  29. #----------------------------------------------------------#
  30. # Logging
  31. log_history "changed associated dns on $ip to $domain" '' 'admin'
  32. log_event "$OK" "$EVENT"
  33. exit