v-add-cron-report 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/bash
  2. # info: add cron reports
  3. # opions: user
  4. #
  5. # The script for enabling reports on cron tasks and administrative
  6. # notifications.
  7. #----------------------------------------------------------#
  8. # Variable&Function #
  9. #----------------------------------------------------------#
  10. # Argument defenition
  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. validate_format '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. if [ $? -ne 0 ]; then
  36. exit E_RESTART
  37. fi
  38. # Logging
  39. log_history "enabled cron reporting"
  40. log_event "$OK" "$EVENT"
  41. exit