v_unsuspend_user 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/bin/bash
  2. # info: unsuspend user
  3. # options: user
  4. #
  5. # The function unsuspends user and all his objects.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument defenition
  10. user=$1
  11. # Importing variables
  12. source $VESTA/conf/vars.conf
  13. source $V_CONF/vesta.conf
  14. source $V_FUNC/shared.func
  15. #----------------------------------------------------------#
  16. # Verifications #
  17. #----------------------------------------------------------#
  18. # Checking arg number
  19. check_args '1' "$#" 'user'
  20. # Checking argument format
  21. format_validation 'user'
  22. # Checking user
  23. is_user_valid
  24. # Checking user vesta
  25. if [ "$user" = 'vesta' ]; then
  26. exit
  27. fi
  28. #----------------------------------------------------------#
  29. # Action #
  30. #----------------------------------------------------------#
  31. # Deleting '!' in front of the password
  32. /usr/sbin/usermod --unlock $user
  33. # Unsuspending web domains
  34. if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" != 'no' ]; then
  35. $V_BIN/v_unsuspend_web_domains $user
  36. fi
  37. # Unsuspending dns domains
  38. if [ ! -z "$DNS_SYSTEM" ] && [ "$DNS_SYSTEM" != 'no' ]; then
  39. $V_BIN/v_unsuspend_dns_domains $user
  40. fi
  41. # Unsuspending mail domains
  42. # TBD
  43. # Unsuspending datbabases
  44. if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ]; then
  45. $V_BIN/v_unsuspend_db_bases $user
  46. fi
  47. # Unsuspending cron jobs
  48. if [ ! -z "$CRON_SYSTEM" ] && [ "$CRON_SYSTEM" != 'no' ]; then
  49. $V_BIN/v_unsuspend_cron_jobs $user
  50. fi
  51. #----------------------------------------------------------#
  52. # Vesta #
  53. #----------------------------------------------------------#
  54. # Adding task to the vesta pipe
  55. restart_schedule 'cron'
  56. restart_schedule 'web'
  57. restart_schedule 'dns'
  58. # Changing suspend value
  59. update_user_value "$user" '$SUSPENDED' 'no'
  60. # Logging
  61. log_event 'system' "$V_EVENT"
  62. exit