v_suspend_sys_cron_job 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/bash
  2. # info: Suspending sys cron
  3. #----------------------------------------------------------#
  4. # Variable&Function #
  5. #----------------------------------------------------------#
  6. # Argument defenition
  7. user="$1"
  8. job="$2"
  9. # Importing variables
  10. source $VESTA/conf/vars.conf
  11. source $V_FUNC/shared_func.sh
  12. source $V_FUNC/cron_func.sh
  13. #----------------------------------------------------------#
  14. # Verifications #
  15. #----------------------------------------------------------#
  16. # Checking arg number
  17. check_args '2' "$#" 'user job'
  18. # Checking argument format
  19. format_validation 'user' 'job'
  20. # Checking user
  21. is_user_valid
  22. # Checking cron job
  23. is_job_valid
  24. # Checking suspend status
  25. is_job_suspended
  26. #----------------------------------------------------------#
  27. # Action #
  28. #----------------------------------------------------------#
  29. # Suspending job
  30. update_cron_job_value '$SUSPEND' '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_event 'system' "$V_EVENT"
  40. exit $OK