v-unsuspend-cron-jobs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. # info: unuspend sys cron
  3. # options: USER [RESTART]
  4. #
  5. # The function unsuspends all suspended cron jobs.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument defenition
  10. user=$1
  11. restart=$2
  12. # Includes
  13. source $VESTA/func/main.sh
  14. source $VESTA/conf/vesta.conf
  15. #----------------------------------------------------------#
  16. # Verifications #
  17. #----------------------------------------------------------#
  18. check_args '1' "$#" 'USER [RESTART]'
  19. validate_format 'user'
  20. is_object_valid 'user' 'USER' "$user"
  21. #----------------------------------------------------------#
  22. # Action #
  23. #----------------------------------------------------------#
  24. # Unsuspendning jobs
  25. for job in $(search_objects 'cron' 'SUSPENDED' 'yes' 'JOB'); do
  26. $BIN/v-unsuspend-cron-job $user $job 'no'
  27. done
  28. #----------------------------------------------------------#
  29. # Vesta #
  30. #----------------------------------------------------------#
  31. # Restart crond
  32. if [ "$restart" != 'no' ]; then
  33. $BIN/v-restart-cron
  34. if [ $? -ne 0 ]; then
  35. exit E_RESTART
  36. fi
  37. fi
  38. # Logging
  39. log_event "$OK" "$EVENT"
  40. exit