v-add-cron-reports 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. # info: add cron reports
  3. # options: user
  4. #
  5. # The script for enabling reports on cron tasks and administrative
  6. # notifications.
  7. #----------------------------------------------------------#
  8. # Variable&Function #
  9. #----------------------------------------------------------#
  10. # Argument definition
  11. user=$1
  12. # Includes
  13. source $VESTA/func/main.sh
  14. source $VESTA/conf/vesta.conf
  15. #----------------------------------------------------------#
  16. # Verifications #
  17. #----------------------------------------------------------#
  18. check_args '1' "$#" 'USER'
  19. is_format_valid 'user'
  20. is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM'
  21. is_object_valid 'user' 'USER' "$user"
  22. is_object_unsuspended 'user' 'USER' "$user"
  23. #----------------------------------------------------------#
  24. # Action #
  25. #----------------------------------------------------------#
  26. # Changing user report value
  27. update_user_value "$user" '$CRON_REPORTS' 'yes'
  28. # Sync system cron with user
  29. sync_cron_jobs
  30. #----------------------------------------------------------#
  31. # Vesta #
  32. #----------------------------------------------------------#
  33. # Restart crond
  34. $BIN/v-restart-cron
  35. check_result $? "Cron restart failed" >/dev/null
  36. # Logging
  37. log_history "enabled cron reporting"
  38. log_event "$OK" "$ARGUMENTS"
  39. exit