forked from outroll/vesta
-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathv-add-cron-reports
executable file
·55 lines (39 loc) · 1.42 KB
/
v-add-cron-reports
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: add cron reports
# options: user
#
# The script for enabling reports on cron tasks and administrative
# notifications.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
user=$1
# Includes
source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'USER'
is_format_valid 'user'
is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Changing user report value
update_user_value "$user" '$CRON_REPORTS' 'yes'
# Sync system cron with user
sync_cron_jobs
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Restart crond
$BIN/v-restart-cron
check_result $? "Cron restart failed" >/dev/null
# Logging
log_history "enabled cron reporting"
log_event "$OK" "$ARGUMENTS"
exit