v-delete-cron-vesta-autoupdate 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/bash
  2. # info: delete vesta autoupdate cron job
  3. # options: NONE
  4. #
  5. # The function deletes vesta autoupdate cron job.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument definition
  10. user=admin
  11. # Includes
  12. source $VESTA/func/main.sh
  13. source $VESTA/conf/vesta.conf
  14. #----------------------------------------------------------#
  15. # Verifications #
  16. #----------------------------------------------------------#
  17. is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM'
  18. check_cron=$(grep 'v-update-sys-vesta-all' $USER_DATA/cron.conf)
  19. if [ -z "$check_cron" ]; then
  20. exit
  21. fi
  22. #----------------------------------------------------------#
  23. # Action #
  24. #----------------------------------------------------------#
  25. # Deleting job
  26. job=$(echo $check_cron|tr ' ' "\n"|grep JOB|cut -f 2 -d "'")
  27. sed -i "/JOB='$job' /d" $USER_DATA/cron.conf
  28. # Sorting jobs by id
  29. sort_cron_jobs
  30. # Sync system cron with user
  31. sync_cron_jobs
  32. #----------------------------------------------------------#
  33. # Vesta #
  34. #----------------------------------------------------------#
  35. # Decreasing cron value
  36. decrease_user_value "$user" '$U_CRON_JOBS'
  37. # Restarting crond
  38. $BIN/v-restart-cron
  39. check_result $? "Cron restart failed" >/dev/null
  40. # Logging
  41. log_event "$OK" "$ARGUMENTS"
  42. exit