forked from outroll/vesta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathv-unsuspend-cron-jobs
executable file
·55 lines (40 loc) · 1.35 KB
/
v-unsuspend-cron-jobs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
# info: unuspend sys cron
# options: USER [RESTART]
#
# The function unsuspends all suspended cron jobs.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
user=$1
restart=$2
# Includes
source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'USER [RESTART]'
validate_format '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 #
#----------------------------------------------------------#
# Restart crond
if [ "$restart" != 'no' ]; then
$BIN/v-restart-cron
if [ $? -ne 0 ]; then
exit $E_RESTART
fi
fi
# Logging
log_event "$OK" "$EVENT"
exit