v_add_sys_user_reports 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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_FUNC/shared_func.sh
  11. source $V_FUNC/cron_func.sh
  12. #----------------------------------------------------------#
  13. # Verifications #
  14. #----------------------------------------------------------#
  15. # Checking arg number
  16. check_args '1' "$#" 'user'
  17. # Checking argument format
  18. format_validation 'user'
  19. # Checking user
  20. is_user_valid
  21. # Checking user is active
  22. is_user_suspended
  23. # Checking reports existance
  24. is_user_key_empty '$REPORTS'
  25. #----------------------------------------------------------#
  26. # Action #
  27. #----------------------------------------------------------#
  28. # Changing user report value
  29. update_user_value "$user" '$REPORTS' 'yes'
  30. # Sync system cron with user
  31. sync_cron_jobs
  32. #----------------------------------------------------------#
  33. # Vesta #
  34. #----------------------------------------------------------#
  35. # Adding task to the vesta pipe
  36. restart_schedule 'cron'
  37. # Logging
  38. log_history "$V_EVENT" "v_del_sys_user_reports $user"
  39. log_event 'system' "$V_EVENT"
  40. exit $OK