Skip to content

Commit 2b16d9b

Browse files
committed
Merge changes from upstream
I'm a little angry
1 parent dcf8492 commit 2b16d9b

File tree

254 files changed

+24485
-24094
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

254 files changed

+24485
-24094
lines changed

bin/v-add-cron-job

Lines changed: 81 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,81 @@
1-
#!/bin/bash
2-
# info: add cron job
3-
# options: user min hour day month wday command [job]
4-
#
5-
# The function adds a job to cron daemon. When executing commands, any output
6-
# is mailed to user's email if parameter REPORTS is set to 'yes'.
7-
8-
9-
#----------------------------------------------------------#
10-
# Variable&Function #
11-
#----------------------------------------------------------#
12-
13-
# Argument defenition
14-
user=$1
15-
min=$2
16-
hour=$3
17-
day=$4
18-
month=$5
19-
wday=$6
20-
command=$(echo $7 | sed -e "s/'/%quote%/g")
21-
job=$8
22-
23-
# Includes
24-
source $VESTA/conf/vesta.conf
25-
source $VESTA/func/main.sh
26-
27-
# Assing new value
28-
A7="$command"
29-
30-
31-
#----------------------------------------------------------#
32-
# Verifications #
33-
#----------------------------------------------------------#
34-
35-
check_args '7' "$#" 'user min hour day month wday command [job]'
36-
validate_format 'user' 'min' 'hour' 'day' 'month' 'wday' 'command'
37-
is_system_enabled $CRON_SYSTEM
38-
is_object_valid 'user' 'USER' "$user"
39-
is_object_unsuspended 'user' 'USER' "$user"
40-
is_package_full 'CRON_JOBS'
41-
get_next_cronjob
42-
validate_format 'job'
43-
is_object_free 'cron' 'JOB' "$job"
44-
45-
46-
#----------------------------------------------------------#
47-
# Action #
48-
#----------------------------------------------------------#
49-
50-
# Concatenating cron string
51-
str="JOB='$job' MIN='$min' HOUR='$hour' DAY='$day' MONTH='$month' WDAY='$wday'"
52-
str="$str CMD='$command' SUSPENDED='no' TIME='$TIME' DATE='$DATE'"
53-
54-
# Adding to crontab
55-
echo "$str" >> $VESTA/data/users/$user/cron.conf
56-
57-
# Chaning permissions
58-
chmod 660 $VESTA/data/users/$user/cron.conf
59-
60-
# Sort jobs by id number
61-
sort_cron_jobs
62-
63-
# Sync cronjobs with system crond
64-
sync_cron_jobs
65-
66-
67-
#----------------------------------------------------------#
68-
# Vesta #
69-
#----------------------------------------------------------#
70-
71-
# Increasing cron value
72-
increase_user_value $user '$U_CRON_JOBS'
73-
74-
# Restart crond
75-
$BIN/v-restart-cron "$EVENT"
76-
77-
# Logging
78-
log_history "added cron job $job"
79-
log_event "$OK" "$EVENT"
80-
81-
exit
1+
#!/bin/bash
2+
# info: add cron job
3+
# options: USER MIN HOUR DAY MONTH WDAY COMMAND [JOB]
4+
#
5+
# The function adds a job to cron daemon. When executing commands, any output
6+
# is mailed to user's email if parameter REPORTS is set to 'yes'.
7+
8+
9+
#----------------------------------------------------------#
10+
# Variable&Function #
11+
#----------------------------------------------------------#
12+
13+
# Argument defenition
14+
user=$1
15+
min=$2
16+
hour=$3
17+
day=$4
18+
month=$5
19+
wday=$6
20+
command=$(echo $7 | sed -e "s/'/%quote%/g")
21+
job=$8
22+
23+
# Includes
24+
source $VESTA/conf/vesta.conf
25+
source $VESTA/func/main.sh
26+
27+
# Assing new value
28+
A7="$command"
29+
30+
31+
#----------------------------------------------------------#
32+
# Verifications #
33+
#----------------------------------------------------------#
34+
35+
check_args '7' "$#" 'USER MIN HOUR DAY MONTH WDAY COMMAND [JOB]'
36+
validate_format 'user' 'min' 'hour' 'day' 'month' 'wday' 'command'
37+
is_system_enabled $CRON_SYSTEM
38+
is_object_valid 'user' 'USER' "$user"
39+
is_object_unsuspended 'user' 'USER' "$user"
40+
is_package_full 'CRON_JOBS'
41+
get_next_cronjob
42+
validate_format 'job'
43+
is_object_free 'cron' 'JOB' "$job"
44+
45+
46+
#----------------------------------------------------------#
47+
# Action #
48+
#----------------------------------------------------------#
49+
50+
# Concatenating cron string
51+
str="JOB='$job' MIN='$min' HOUR='$hour' DAY='$day' MONTH='$month' WDAY='$wday'"
52+
str="$str CMD='$command' SUSPENDED='no' TIME='$TIME' DATE='$DATE'"
53+
54+
# Adding to crontab
55+
echo "$str" >> $VESTA/data/users/$user/cron.conf
56+
57+
# Chaning permissions
58+
chmod 660 $VESTA/data/users/$user/cron.conf
59+
60+
# Sort jobs by id number
61+
sort_cron_jobs
62+
63+
# Sync cronjobs with system crond
64+
sync_cron_jobs
65+
66+
67+
#----------------------------------------------------------#
68+
# Vesta #
69+
#----------------------------------------------------------#
70+
71+
# Increasing cron value
72+
increase_user_value $user '$U_CRON_JOBS'
73+
74+
# Restart crond
75+
$BIN/v-restart-cron "$EVENT"
76+
77+
# Logging
78+
log_history "added cron job $job"
79+
log_event "$OK" "$EVENT"
80+
81+
exit

bin/v-add-cron-report

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,54 @@
1-
#!/bin/bash
2-
# info: add cron reports
3-
# opions: user
4-
#
5-
# The script for enabling reports on cron tasks and administrative
6-
# notifications.
7-
8-
9-
#----------------------------------------------------------#
10-
# Variable&Function #
11-
#----------------------------------------------------------#
12-
13-
# Argument defenition
14-
user=$1
15-
16-
# Includes
17-
source $VESTA/conf/vesta.conf
18-
source $VESTA/func/main.sh
19-
20-
21-
#----------------------------------------------------------#
22-
# Verifications #
23-
#----------------------------------------------------------#
24-
25-
check_args '1' "$#" 'user'
26-
validate_format 'user'
27-
is_system_enabled "$CRON_SYSTEM"
28-
is_object_valid 'user' 'USER' "$user"
29-
is_object_unsuspended 'user' 'USER' "$user"
30-
31-
32-
#----------------------------------------------------------#
33-
# Action #
34-
#----------------------------------------------------------#
35-
36-
# Changing user report value
37-
update_user_value "$user" '$CRON_REPORTS' 'yes'
38-
39-
# Sync system cron with user
40-
sync_cron_jobs
41-
42-
43-
#----------------------------------------------------------#
44-
# Vesta #
45-
#----------------------------------------------------------#
46-
47-
# Restart crond
48-
$BIN/v-restart-cron "$EVENT"
49-
50-
# Logging
51-
log_history "enabled cron reporting"
52-
log_event "$OK" "$EVENT"
53-
54-
exit
1+
#!/bin/bash
2+
# info: add cron reports
3+
# opions: user
4+
#
5+
# The script for enabling reports on cron tasks and administrative
6+
# notifications.
7+
8+
9+
#----------------------------------------------------------#
10+
# Variable&Function #
11+
#----------------------------------------------------------#
12+
13+
# Argument defenition
14+
user=$1
15+
16+
# Includes
17+
source $VESTA/conf/vesta.conf
18+
source $VESTA/func/main.sh
19+
20+
21+
#----------------------------------------------------------#
22+
# Verifications #
23+
#----------------------------------------------------------#
24+
25+
check_args '1' "$#" 'USER'
26+
validate_format 'user'
27+
is_system_enabled "$CRON_SYSTEM"
28+
is_object_valid 'user' 'USER' "$user"
29+
is_object_unsuspended 'user' 'USER' "$user"
30+
31+
32+
#----------------------------------------------------------#
33+
# Action #
34+
#----------------------------------------------------------#
35+
36+
# Changing user report value
37+
update_user_value "$user" '$CRON_REPORTS' 'yes'
38+
39+
# Sync system cron with user
40+
sync_cron_jobs
41+
42+
43+
#----------------------------------------------------------#
44+
# Vesta #
45+
#----------------------------------------------------------#
46+
47+
# Restart crond
48+
$BIN/v-restart-cron "$EVENT"
49+
50+
# Logging
51+
log_history "enabled cron reporting"
52+
log_event "$OK" "$EVENT"
53+
54+
exit

0 commit comments

Comments
 (0)