mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 18:49:21 -07:00
autoupdates
This commit is contained in:
parent
83bd13f199
commit
44d907f202
8 changed files with 284 additions and 0 deletions
63
bin/v-delete-cron-vesta-autoupdate
Executable file
63
bin/v-delete-cron-vesta-autoupdate
Executable file
|
@ -0,0 +1,63 @@
|
|||
#!/bin/bash
|
||||
# info: delete vesta autoupdate cron job
|
||||
# options: NONE
|
||||
#
|
||||
# The function deletes vesta autoupdate cron job.
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument defenition
|
||||
user=admin
|
||||
|
||||
# Includes
|
||||
source $VESTA/func/main.sh
|
||||
source $VESTA/conf/vesta.conf
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM'
|
||||
check_cron=$(grep 'v-update-sys-vesta-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
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Decreasing cron value
|
||||
decrease_user_value "$user" '$U_CRON_JOBS'
|
||||
|
||||
# Restart crond
|
||||
$BIN/v-restart-cron
|
||||
if [ $? -ne 0 ]; then
|
||||
exit $E_RESTART
|
||||
fi
|
||||
|
||||
# Logging
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
Loading…
Add table
Add a link
Reference in a new issue