v_del_sys_cron 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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_CONF/vesta.conf
  12. source $V_FUNC/shared.func
  13. source $V_FUNC/cron.func
  14. #----------------------------------------------------------#
  15. # Verifications #
  16. #----------------------------------------------------------#
  17. # Checking arg number
  18. check_args '2' "$#" 'user job'
  19. # Checking argument format
  20. format_validation 'user' 'job'
  21. # Checking user
  22. is_user_valid
  23. # Checking user is active
  24. is_user_suspended
  25. # Checking cron job
  26. is_job_valid
  27. #----------------------------------------------------------#
  28. # Action #
  29. #----------------------------------------------------------#
  30. # Deleting job
  31. del_cron_job
  32. # Sorting jobs by id
  33. sort_cron_jobs
  34. # Sync system cron with user
  35. sync_cron_jobs
  36. #----------------------------------------------------------#
  37. # Vesta #
  38. #----------------------------------------------------------#
  39. # Adding task to the vesta pipe
  40. restart_schedule 'cron'
  41. # Logging
  42. log_event 'system' "$V_EVENT"
  43. exit