Skip to content

Commit ba50b1c

Browse files
committed
Added cron tab triggers. Issue hestiacp#50
1 parent 18c9bf4 commit ba50b1c

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

bin/v_suspend_cron_job

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ is_job_suspended
4646

4747
# Suspending job
4848
update_cron_job_value '$SUSPENDED' 'yes'
49+
increase_user_value "$user" '$SUSPENDED_CRON'
4950

5051
# Sync system cron with user
5152
sync_cron_jobs
@@ -56,7 +57,9 @@ sync_cron_jobs
5657
#----------------------------------------------------------#
5758

5859
# Adding task to the vesta pipe
59-
restart_schedule 'cron'
60+
if [ "$3" != 'no_restart' ]; then
61+
restart_schedule 'cron'
62+
fi
6063

6164
# Logging
6265
log_event 'system' "$V_EVENT"

bin/v_suspend_cron_jobs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs=$(cron_clear_search)
4545

4646
# Suspendning
4747
for job in $jobs; do
48-
update_cron_job_value '$SUSPENDED' 'yes'
48+
$V_BIN/v_suspend_cron_job $user $job 'no_restart'
4949
done
5050

5151
# Sync system cron with user

bin/v_unsuspend_cron_job

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ is_job_unsuspended
4646

4747
# Unsuspending job
4848
update_cron_job_value '$SUSPENDED' 'no'
49+
decrease_user_value "$user" '$SUSPENDED_CRON'
4950

5051
# Sync system cron with user
5152
sync_cron_jobs
@@ -56,7 +57,9 @@ sync_cron_jobs
5657
#----------------------------------------------------------#
5758

5859
# Adding task to the vesta pipe
59-
restart_schedule 'cron'
60+
if [ "$3" != 'no_restart' ]; then
61+
restart_schedule 'cron'
62+
fi
6063

6164
# Logging
6265
log_event 'system' "$V_EVENT"

bin/v_unsuspend_cron_jobs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs=$(cron_clear_search)
4545

4646
# Unsuspendning jobs
4747
for job in $jobs; do
48-
update_cron_job_value '$SUSPENDED' 'no'
48+
$V_BIN/v_unsuspend_cron_job $user $job 'no_restart'
4949
done
5050

5151
# Sync system cron with user

0 commit comments

Comments
 (0)