v_delete_cron_job 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/bash
  2. # info: delete cron job
  3. # options: user job
  4. #
  5. # The function deletes cron job.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument defenition
  10. user=$1
  11. job=$2
  12. # Importing variables
  13. source $VESTA/conf/vars.conf
  14. source $V_CONF/vesta.conf
  15. source $V_FUNC/shared.func
  16. source $V_FUNC/cron.func
  17. #----------------------------------------------------------#
  18. # Verifications #
  19. #----------------------------------------------------------#
  20. # Checking arg number
  21. check_args '2' "$#" 'user job'
  22. # Checking argument format
  23. format_validation 'user' 'job'
  24. # Checking user
  25. is_user_valid
  26. # Checking user is active
  27. is_user_suspended
  28. # Checking cron job
  29. is_job_valid
  30. #----------------------------------------------------------#
  31. # Action #
  32. #----------------------------------------------------------#
  33. # Deleting job
  34. del_cron_job
  35. # Sorting jobs by id
  36. sort_cron_jobs
  37. # Sync system cron with user
  38. sync_cron_jobs
  39. #----------------------------------------------------------#
  40. # Vesta #
  41. #----------------------------------------------------------#
  42. # Decreasing cron value
  43. decrease_user_value "$user" '$U_CRON_JOBS'
  44. # Adding task to the vesta pipe
  45. restart_schedule 'cron'
  46. # Logging
  47. log_event 'system' "$V_EVENT"
  48. exit