v_add_sys_user_reports 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/bash
  2. # info: adding user reports
  3. #----------------------------------------------------------#
  4. # Variable&Function #
  5. #----------------------------------------------------------#
  6. # Argument defenition
  7. user=$1
  8. # Importing variables
  9. source $VESTA/conf/vars.conf
  10. source $V_CONF/vesta.conf
  11. source $V_FUNC/shared.func
  12. source $V_FUNC/cron.func
  13. #----------------------------------------------------------#
  14. # Verifications #
  15. #----------------------------------------------------------#
  16. # Checking arg number
  17. check_args '1' "$#" 'user'
  18. # Checking argument format
  19. format_validation 'user'
  20. # Checking user
  21. is_user_valid
  22. # Checking user is active
  23. is_user_suspended
  24. # Checking reports existance
  25. is_user_key_empty '$REPORTS'
  26. #----------------------------------------------------------#
  27. # Action #
  28. #----------------------------------------------------------#
  29. # Changing user report value
  30. update_user_value "$user" '$REPORTS' 'yes'
  31. # Sync system cron with user
  32. sync_cron_jobs
  33. #----------------------------------------------------------#
  34. # Vesta #
  35. #----------------------------------------------------------#
  36. # Adding task to the vesta pipe
  37. restart_schedule 'cron'
  38. # Logging
  39. log_history "$V_EVENT" "v_del_sys_user_reports $user"
  40. log_event 'system' "$V_EVENT"
  41. exit