v_change_sys_user_name 1.4 KB

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