v_change_sys_user_ns 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. # info: changing user nameservers
  3. #----------------------------------------------------------#
  4. # Variable&Function #
  5. #----------------------------------------------------------#
  6. # Argument defenition
  7. user="$1"
  8. ns1="$2"
  9. ns2="$3"
  10. # Importing variables
  11. source $VESTA/conf/vars.conf
  12. source $V_FUNC/shared_func.sh
  13. #----------------------------------------------------------#
  14. # Verifications #
  15. #----------------------------------------------------------#
  16. # Checking args
  17. check_args '3' "$#" 'user ns1 ns2'
  18. # Checking argument format
  19. format_validation 'user' 'ns1' 'ns2'
  20. # Checking user
  21. is_user_valid
  22. # Checking user is active
  23. is_user_suspended
  24. #----------------------------------------------------------#
  25. # Action #
  26. #----------------------------------------------------------#
  27. # Get old values
  28. old_ns1=$(get_user_value '$NS1')
  29. old_ns2=$(get_user_value '$NS2')
  30. # Changing ns values
  31. update_user_value "$user" '$NS1' "$ns1"
  32. update_user_value "$user" '$NS2' "$ns2"
  33. #----------------------------------------------------------#
  34. # Vesta #
  35. #----------------------------------------------------------#
  36. # Logging
  37. log_history "$V_EVENT" "$V_SCRIPT $user $old_ns1 $old_ns2"
  38. log_event 'system' "$V_EVENT"
  39. exit $OK