myvesta/bin/v-unsuspend-cron-jobs
2017-01-11 16:52:11 +02:00

52 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# info: unsuspend sys cron
# options: USER [RESTART]
#
# The function unsuspends all suspended cron jobs.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
user=$1
restart=$2
# Includes
source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'USER [RESTART]'
is_format_valid 'user'
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 #
#----------------------------------------------------------#
# Restarting crond
$BIN/v-restart-cron $restart
check_result $? "Cron restart failed" >/dev/null
# Logging
log_event "$OK" "$ARGUMENTS"
exit