Skip to content

Commit fad19fe

Browse files
author
core01
committed
Merge remote-tracking branch 'upstream/master'
2 parents fdd3537 + 4adbef4 commit fad19fe

File tree

894 files changed

+26802
-14786
lines changed

Some content is hidden

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

894 files changed

+26802
-14786
lines changed

bin/v-acknowledge-user-notification

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf
2323
#----------------------------------------------------------#
2424

2525
check_args '2' "$#" 'USER NOTIFICATION'
26-
validate_format 'user' 'nid'
26+
is_format_valid 'user' 'nid'
2727
is_object_valid 'user' 'USER' "$user"
2828

2929

@@ -61,6 +61,6 @@ if [ "$notice" = 'no' ]; then
6161
fi
6262

6363
# Logging
64-
log_event "$OK" "$EVENT"
64+
log_event "$OK" "$ARGUMENTS"
6565

6666
exit

bin/v-activate-vesta-license

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ if [ "$module" = 'SFTPJAIL' ]; then
6262
fi
6363

6464
# Logging
65-
log_event "$OK" "$EVENT"
65+
log_event "$OK" "$ARGUMENTS"
6666

6767
exit

bin/v-add-backup-host

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ EOF
9494

9595
if [ "$type" != 'local' ];then
9696
check_args '4' "$#" "TYPE HOST USERNAME PASSWORD [PATH] [PORT]"
97-
validate_format 'host'
97+
is_format_valid 'host'
9898
is_password_valid
9999
if [ "$type" = 'sftp' ]; then
100100
which expect >/dev/null 2>&1
@@ -117,7 +117,7 @@ if [ "$type" = 'ftp' ]; then
117117
grep -i -e failed -e error -e "can't" -e "not conn" -e "incorrect")
118118
if [ ! -z "$ferror" ]; then
119119
echo "Error: can't login to ftp $user@$host"
120-
log_event "$E_CONNECT" "$EVENT"
120+
log_event "$E_CONNECT" "$ARGUMENTS"
121121
exit $E_CONNECT
122122
fi
123123

@@ -129,37 +129,38 @@ if [ "$type" = 'ftp' ]; then
129129
echo "$ftp_result"
130130
rm -rf $tmpdir
131131
echo "Error: can't create $ftmpdir folder on the ftp"
132-
log_event "$E_FTP" "$EVENT"
132+
log_event "$E_FTP" "$ARGUMENTS"
133133
exit $E_FTP
134134
fi
135135
fi
136136
if [ "$type" = 'sftp' ]; then
137137
if [ -z $port ]; then
138138
port=22
139139
fi
140-
sftmpdir="$path/vst.bK76A9SUkt"
141-
sftpc "mkdir $sftmpdir" "rmdir $sftmpdir" > /dev/null 2>&1
140+
if sftpc "mkdir $path" > /dev/null 2>&1 ; then
141+
sftmpdir="$path/vst.bK76A9SUkt"
142+
sftpc "mkdir $sftmpdir" "rmdir $sftmpdir" > /dev/null 2>&1
143+
fi
142144
rc=$?
143145
if [[ "$rc" != 0 ]]; then
144146
case $rc in
145147
$E_CONNECT) echo "Error: can't login to sftp $user@$host";;
146148
$E_FTP) echo "Error: can't create temp folder on the sftp host";;
147149
esac
148-
log_event "$rc" "$EVENT"
150+
log_event "$rc" "$ARGUMENTS"
149151
exit "$rc"
150152
fi
151153
fi
152154

153155

154156
# Adding backup host
155157
if [ $type != 'local' ]; then
156-
echo "HOST='$host'
157-
USERNAME='$user'
158-
PASSWORD='$password'
159-
BPATH='$path'
160-
PORT='$port'
161-
TIME='$TIME'
162-
DATE='$DATE'" > $VESTA/conf/$type.backup.conf
158+
time_n_date=$(date +'%T %F')
159+
time=$(echo "$time_n_date" |cut -f 1 -d \ )
160+
date=$(echo "$time_n_date" |cut -f 2 -d \ )
161+
str="HOST='$host'\nUSERNAME='$user'\nPASSWORD='$password'"
162+
str="$str\nBPATH='$path'\nPORT='$port'\nTIME='$time'\nDATE='$date'"
163+
echo -e "$str" > $VESTA/conf/$type.backup.conf
163164
chmod 660 $VESTA/conf/$type.backup.conf
164165
fi
165166

@@ -181,6 +182,6 @@ else
181182
fi
182183

183184
# Logging
184-
log_event "$OK" "$EVENT"
185+
log_event "$OK" "$ARGUMENTS"
185186

186187
exit

bin/v-add-cron-job

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,40 +17,44 @@ hour=$3
1717
day=$4
1818
month=$5
1919
wday=$6
20-
command=$(echo $7 | sed "s/'/%quote%/g")
20+
command=$(echo $7 |sed "s/'/%quote%/g")
2121
job=$8
2222
restart=$9
2323

2424
# Includes
2525
source $VESTA/func/main.sh
2626
source $VESTA/conf/vesta.conf
2727

28-
# Assigning new value
29-
A7="$command"
28+
HIDE=7
3029

3130

3231
#----------------------------------------------------------#
3332
# Verifications #
3433
#----------------------------------------------------------#
3534

3635
check_args '7' "$#" 'USER MIN HOUR DAY MONTH WDAY COMMAND [JOB] [RESTART]'
37-
validate_format 'user' 'min' 'hour' 'day' 'month' 'wday' 'command'
36+
is_format_valid 'user' 'min' 'hour' 'day' 'month' 'wday' 'command'
3837
is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM'
3938
is_object_valid 'user' 'USER' "$user"
4039
is_object_unsuspended 'user' 'USER' "$user"
4140
is_package_full 'CRON_JOBS'
4241
get_next_cronjob
43-
validate_format 'job'
42+
is_format_valid 'job'
4443
is_object_new 'cron' 'JOB' "$job"
4544

4645

4746
#----------------------------------------------------------#
4847
# Action #
4948
#----------------------------------------------------------#
5049

50+
# Generating timestamp
51+
time_n_date=$(date +'%T %F')
52+
time=$(echo "$time_n_date" |cut -f 1 -d \ )
53+
date=$(echo "$time_n_date" |cut -f 2 -d \ )
54+
5155
# Concatenating cron string
5256
str="JOB='$job' MIN='$min' HOUR='$hour' DAY='$day' MONTH='$month' WDAY='$wday'"
53-
str="$str CMD='$command' SUSPENDED='no' TIME='$TIME' DATE='$DATE'"
57+
str="$str CMD='$command' SUSPENDED='no' TIME='$time' DATE='$date'"
5458

5559
# Adding to crontab
5660
echo "$str" >> $VESTA/data/users/$user/cron.conf
@@ -78,6 +82,6 @@ check_result $? "Cron restart failed" >/dev/null
7882

7983
# Logging
8084
log_history "added cron job $job"
81-
log_event "$OK" "$EVENT"
85+
log_event "$OK" "$ARGUMENTS"
8286

8387
exit

bin/v-add-cron-reports

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ source $VESTA/conf/vesta.conf
2323
#----------------------------------------------------------#
2424

2525
check_args '1' "$#" 'USER'
26-
validate_format 'user'
26+
is_format_valid 'user'
2727
is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM'
2828
is_object_valid 'user' 'USER' "$user"
2929
is_object_unsuspended 'user' 'USER' "$user"
@@ -50,6 +50,6 @@ check_result $? "Cron restart failed" >/dev/null
5050

5151
# Logging
5252
log_history "enabled cron reporting"
53-
log_event "$OK" "$EVENT"
53+
log_event "$OK" "$ARGUMENTS"
5454

5555
exit

bin/v-add-cron-restart-job

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ fi
3838
#----------------------------------------------------------#
3939

4040
# Logging
41-
log_event "$OK" "$EVENT"
41+
log_event "$OK" "$ARGUMENTS"
4242

4343
exit

bin/v-add-cron-vesta-autoupdate

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,22 @@ fi
3434
# Action #
3535
#----------------------------------------------------------#
3636

37+
# Generating timestamp
38+
time_n_date=$(date +'%T %F')
39+
time=$(echo "$time_n_date" |cut -f 1 -d \ )
40+
date=$(echo "$time_n_date" |cut -f 2 -d \ )
41+
3742
# Define time somewhere at night
38-
min=$(gen_password '012345' '2')
39-
hour=$(gen_password '1234567' '1')
43+
min=$(generate_password '012345' '2')
44+
hour=$(generate_password '1234567' '1')
4045
day='*'
4146
month='*'
4247
wday='*'
4348
command='sudo /usr/local/vesta/bin/v-update-sys-vesta-all'
4449

4550
# Concatenating cron string
4651
str="JOB='$job' MIN='$min' HOUR='$hour' DAY='$day' MONTH='$month' WDAY='$wday'"
47-
str="$str CMD='$command' SUSPENDED='no' TIME='$TIME' DATE='$DATE'"
52+
str="$str CMD='$command' SUSPENDED='no' TIME='$time' DATE='$date'"
4853

4954
# Adding to crontab
5055
echo "$str" >> $VESTA/data/users/$user/cron.conf
@@ -72,6 +77,6 @@ check_result $? "Cron restart failed" >/dev/null
7277

7378
# Logging
7479
log_history "added cron job $job"
75-
log_event "$OK" "$EVENT"
80+
log_event "$OK" "$ARGUMENTS"
7681

7782
exit

bin/v-add-database

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ source $VESTA/conf/vesta.conf
3636
#----------------------------------------------------------#
3737

3838
check_args '4' "$#" 'USER DATABASE DBUSER DBPASS [TYPE] [HOST] [CHARSET]'
39-
validate_format 'user' 'database' 'dbuser' 'charset'
39+
is_format_valid 'user' 'database' 'dbuser' 'charset'
4040
is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM'
4141
is_type_valid "$DB_SYSTEM" "$type"
4242
is_object_valid 'user' 'USER' "$user"
4343
is_object_unsuspended 'user' 'USER' "$user"
4444
is_object_new 'db' 'DB' "$database"
4545
get_next_dbhost
46-
is_object_valid "../../../conf/$type" 'DBHOST' "$host"
46+
is_object_valid "../../../conf/$type" 'HOST' "$host"
4747
is_object_unsuspended "../../../conf/$type" 'DBHOST' "$host"
4848
#is_charset_valid
4949
is_package_full 'DATABASES'
@@ -66,14 +66,15 @@ esac
6666
# Vesta #
6767
#----------------------------------------------------------#
6868

69-
# Update time and date
70-
DATE=$(date +%F)
71-
TIME=$(date +%T)
69+
# Generating timestamp
70+
time_n_date=$(date +'%T %F')
71+
time=$(echo "$time_n_date" |cut -f 1 -d \ )
72+
date=$(echo "$time_n_date" |cut -f 2 -d \ )
7273

7374
# Adding db to db conf
7475
str="DB='$database' DBUSER='$dbuser' MD5='$md5' HOST='$host' TYPE='$type'"
75-
str="$str CHARSET='$charset' U_DISK='0' SUSPENDED='no' TIME='$TIME'"
76-
str="$str DATE='$DATE'"
76+
str="$str CHARSET='$charset' U_DISK='0' SUSPENDED='no' TIME='$time'"
77+
str="$str DATE='$date'"
7778
echo "$str" >> $USER_DATA/db.conf
7879
chmod 660 $USER_DATA/db.conf
7980

@@ -83,6 +84,6 @@ increase_user_value "$user" '$U_DATABASES'
8384

8485
# Logging
8586
log_history "added $type database $database"
86-
log_event "$OK" "$EVENT"
87+
log_event "$OK" "$ARGUMENTS"
8788

8889
exit

bin/v-add-database-host

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ is_mysql_host_alive() {
3838
rm $mycnf
3939
if [ '0' -ne "$?" ]; then
4040
echo "Error: MySQL connection to $host failed"
41-
log_event "$E_CONNECT" "$EVENT"
41+
log_event "$E_CONNECT" "$ARGUMENTS"
4242
exit $E_CONNECT
4343
fi
4444
}
@@ -48,7 +48,7 @@ is_pgsql_host_alive() {
4848
psql -h $host -U $dbuser -c "SELECT VERSION()" > /dev/null 2>&1
4949
if [ '0' -ne "$?" ]; then
5050
echo "Error: PostgreSQL connection to $host failed"
51-
log_event "$E_CONNECT" "$EVENT"
51+
log_event "$E_CONNECT" "$ARGUMENTS"
5252
exit $E_CONNECT
5353
fi
5454
}
@@ -60,7 +60,7 @@ is_pgsql_host_alive() {
6060

6161
args_usage='TYPE HOST DBUSER DBPASS [MAX_DB] [CHARSETS] [TPL]'
6262
check_args '4' "$#" "$args_usage"
63-
validate_format 'host' 'dbuser' 'max_db' 'charsets' 'template'
63+
is_format_valid 'host' 'dbuser' 'max_db' 'charsets' 'template'
6464
#is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM'
6565
#is_type_valid "$DB_SYSTEM" "$type"
6666
is_dbhost_new
@@ -76,19 +76,23 @@ esac
7676
# Action #
7777
#----------------------------------------------------------#
7878

79+
# Generating timestamp
80+
time_n_date=$(date +'%T %F')
81+
time=$(echo "$time_n_date" |cut -f 1 -d \ )
82+
date=$(echo "$time_n_date" |cut -f 2 -d \ )
83+
7984
# Concatenating db host string
8085
case $type in
8186
mysql) str="HOST='$host' USER='$dbuser' PASSWORD='$dbpass'";
8287
str="$str CHARSETS='$charsets' MAX_DB='$max_db' U_SYS_USERS=''";
83-
str="$str U_DB_BASES='0' SUSPENDED='no' TIME='$TIME' DATE='$DATE'";;
88+
str="$str U_DB_BASES='0' SUSPENDED='no' TIME='$time' DATE='$date'";;
8489
pgsql) str="HOST='$host' USER='$dbuser' PASSWORD='$dbpass'";
8590
str="$str CHARSETS='$charsets' TPL='$template' MAX_DB='$max_db'";
8691
str="$str U_SYS_USERS='' U_DB_BASES='0' SUSPENDED='no'";
87-
str="$str TIME='$TIME' DATE='$DATE'";;
92+
str="$str TIME='$time' DATE='$date'";;
8893
esac
8994

9095

91-
9296
#----------------------------------------------------------#
9397
# Vesta #
9498
#----------------------------------------------------------#
@@ -110,6 +114,6 @@ else
110114
fi
111115

112116
# Logging
113-
log_event "$OK" "$EVENT"
117+
log_event "$OK" "$ARGUMENTS"
114118

115119
exit

0 commit comments

Comments
 (0)