Skip to content

Commit aaa9952

Browse files
authored
Add cron delete script for hestia auto updater.
1 parent 67998f5 commit aaa9952

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
# info: delete hestia autoupdate cron job
3+
# options: NONE
4+
#
5+
# The function deletes hestia autoupdate cron job.
6+
7+
8+
#----------------------------------------------------------#
9+
# Variable&Function #
10+
#----------------------------------------------------------#
11+
12+
# Argument definition
13+
user=admin
14+
15+
# Includes
16+
source $HESTIA/func/main.sh
17+
source $HESTIA/conf/hestia.conf
18+
19+
20+
#----------------------------------------------------------#
21+
# Verifications #
22+
#----------------------------------------------------------#
23+
24+
is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM'
25+
check_cron=$(grep 'v-update-sys-hestia-all' $USER_DATA/cron.conf)
26+
if [ -z "$check_cron" ]; then
27+
exit
28+
fi
29+
30+
31+
#----------------------------------------------------------#
32+
# Action #
33+
#----------------------------------------------------------#
34+
35+
36+
# Deleting job
37+
job=$(echo $check_cron|tr ' ' "\n"|grep JOB|cut -f 2 -d "'")
38+
sed -i "/JOB='$job' /d" $USER_DATA/cron.conf
39+
40+
# Sorting jobs by id
41+
sort_cron_jobs
42+
43+
# Sync system cron with user
44+
sync_cron_jobs
45+
46+
47+
#----------------------------------------------------------#
48+
# Hestia #
49+
#----------------------------------------------------------#
50+
51+
# Decreasing cron value
52+
decrease_user_value "$user" '$U_CRON_JOBS'
53+
54+
# Restarting crond
55+
$BIN/v-restart-cron
56+
check_result $? "Cron restart failed" >/dev/null
57+
58+
# Logging
59+
log_event "$OK" "$ARGUMENTS"
60+
61+
exit

0 commit comments

Comments
 (0)