Просмотр исходного кода

Add cron delete script for hestia auto updater.

Raphael Schneeberger 7 лет назад
Родитель
Сommit
aaa9952c0c
1 измененных файлов с 61 добавлено и 0 удалено
  1. 61 0
      bin/v-delete-cron-hestia-autoupdate

+ 61 - 0
bin/v-delete-cron-hestia-autoupdate

@@ -0,0 +1,61 @@
+#!/bin/bash
+# info: delete hestia autoupdate cron job
+# options: NONE
+#
+# The function deletes hestia autoupdate cron job.
+
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Argument definition
+user=admin
+
+# Includes
+source $HESTIA/func/main.sh
+source $HESTIA/conf/hestia.conf
+
+
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+
+is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM'
+check_cron=$(grep 'v-update-sys-hestia-all' $USER_DATA/cron.conf)
+if [ -z "$check_cron" ]; then
+    exit
+fi
+
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+
+
+# Deleting job
+job=$(echo $check_cron|tr ' ' "\n"|grep JOB|cut -f 2 -d "'")
+sed -i "/JOB='$job' /d" $USER_DATA/cron.conf
+
+# Sorting jobs by id
+sort_cron_jobs
+
+# Sync system cron with user
+sync_cron_jobs
+
+
+#----------------------------------------------------------#
+#                       Hestia                             #
+#----------------------------------------------------------#
+
+# Decreasing cron value
+decrease_user_value "$user" '$U_CRON_JOBS'
+
+# Restarting crond
+$BIN/v-restart-cron
+check_result $? "Cron restart failed" >/dev/null
+
+# Logging
+log_event "$OK" "$ARGUMENTS"
+
+exit