1
0
mirror of https://github.com/myvesta/vesta.git synced 2025-03-11 12:02:42 -07:00
myvesta/bin/v-unsuspend-cron-jobs

52 lines
1.3 KiB
Plaintext
Raw Normal View History

2013-01-19 23:07:26 +02:00
#!/bin/bash
2015-11-06 17:38:58 +02:00
# info: unsuspend sys cron
2013-01-19 23:07:26 +02:00
# options: USER [RESTART]
#
# The function unsuspends all suspended cron jobs.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
2015-11-06 17:38:58 +02:00
# Argument definition
2013-01-19 23:07:26 +02:00
user=$1
restart=$2
# Includes
source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf
2013-01-19 23:07:26 +02:00
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'USER [RESTART]'
is_format_valid 'user'
2013-01-19 23:07:26 +02:00
is_object_valid 'user' 'USER' "$user"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Unsuspendning jobs
for job in $(search_objects 'cron' 'SUSPENDED' 'yes' 'JOB'); do
$BIN/v-unsuspend-cron-job $user $job 'no'
done
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
2015-10-28 16:34:41 +02:00
# Restarting crond
$BIN/v-restart-cron $restart
check_result $? "Cron restart failed" >/dev/null
2013-01-19 23:07:26 +02:00
# Logging
log_event "$OK" "$ARGUMENTS"
2013-01-19 23:07:26 +02:00
exit