v_del_sys_cron 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/bash
  2. # info: deleting 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 user is active
  23. is_user_suspended
  24. # Checking cron job
  25. is_job_valid
  26. #----------------------------------------------------------#
  27. # Action #
  28. #----------------------------------------------------------#
  29. # Deleting job
  30. del_cron_job
  31. # Sorting jobs by id
  32. sort_cron_jobs
  33. # Sync system cron with user
  34. sync_cron_jobs
  35. #----------------------------------------------------------#
  36. # Vesta #
  37. #----------------------------------------------------------#
  38. # Adding task to the vesta pipe
  39. restart_schedule 'cron'
  40. # Logging
  41. log_event 'system' "$V_EVENT"
  42. exit $OK