Преглед изворни кода

Added cron tab triggers. Issue #50

Serghey Rodin пре 14 година
родитељ
комит
ba50b1c4c0
4 измењених фајлова са 10 додато и 4 уклоњено
  1. 4 1
      bin/v_suspend_cron_job
  2. 1 1
      bin/v_suspend_cron_jobs
  3. 4 1
      bin/v_unsuspend_cron_job
  4. 1 1
      bin/v_unsuspend_cron_jobs

+ 4 - 1
bin/v_suspend_cron_job

@@ -46,6 +46,7 @@ is_job_suspended
 
 # Suspending job
 update_cron_job_value '$SUSPENDED' 'yes'
+increase_user_value "$user" '$SUSPENDED_CRON'
 
 # Sync system cron with user
 sync_cron_jobs
@@ -56,7 +57,9 @@ sync_cron_jobs
 #----------------------------------------------------------#
 
 # Adding task to the vesta pipe
-restart_schedule 'cron'
+if [ "$3" != 'no_restart' ]; then
+    restart_schedule 'cron'
+fi
 
 # Logging
 log_event 'system' "$V_EVENT"

+ 1 - 1
bin/v_suspend_cron_jobs

@@ -45,7 +45,7 @@ jobs=$(cron_clear_search)
 
 # Suspendning
 for job in $jobs; do
-    update_cron_job_value '$SUSPENDED' 'yes'
+    $V_BIN/v_suspend_cron_job $user $job 'no_restart'
 done
 
 # Sync system cron with user

+ 4 - 1
bin/v_unsuspend_cron_job

@@ -46,6 +46,7 @@ is_job_unsuspended
 
 # Unsuspending job
 update_cron_job_value '$SUSPENDED' 'no'
+decrease_user_value "$user" '$SUSPENDED_CRON'
 
 # Sync system cron with user
 sync_cron_jobs
@@ -56,7 +57,9 @@ sync_cron_jobs
 #----------------------------------------------------------#
 
 # Adding task to the vesta pipe
-restart_schedule 'cron'
+if [ "$3" != 'no_restart' ]; then
+    restart_schedule 'cron'
+fi
 
 # Logging
 log_event 'system' "$V_EVENT"

+ 1 - 1
bin/v_unsuspend_cron_jobs

@@ -45,7 +45,7 @@ jobs=$(cron_clear_search)
 
 # Unsuspendning jobs
 for job in $jobs; do
-    update_cron_job_value '$SUSPENDED' 'no'
+    $V_BIN/v_unsuspend_cron_job $user $job 'no_restart'
 done
 
 # Sync system cron with user