Skip to content

Commit c63ecda

Browse files
committed
Merge branch 'pr/3'
2 parents 255c08a + 9eca029 commit c63ecda

File tree

7 files changed

+83
-32
lines changed

7 files changed

+83
-32
lines changed

bin/v-backup-user

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,7 @@ is_backup_enabled
3939
# Action #
4040
#----------------------------------------------------------#
4141

42-
# block backup if current hour is after 6 AM
43-
WAIT_LOOP_ENTERED=0
44-
if pgrep -x "v-backup-users" > /dev/null
45-
then
46-
hour=$(date +"%H");
47-
while [ "$hour" -gt "6" ]; do
48-
if [ "$WAIT_LOOP_ENTERED" -eq 0 ]; then
49-
$BIN/v-restart-web-backend
50-
fi
51-
WAIT_LOOP_ENTERED=1
52-
current_date_time="`date "+%Y-%m-%d %H:%M:%S"`";
53-
echo "$current_date_time - wait for backup user $user - hour $hour";
54-
sleep 300
55-
hour=$(date +"%H");
56-
done
57-
fi
42+
wait_for_backup_if_it_is_not_time_for_backup
5843

5944
# Set backup directory if undefined
6045
if [ -z "$BACKUP" ]; then
@@ -153,6 +138,7 @@ if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB" != '*' ]; then
153138
i=0
154139

155140
for domain in $web_list; do
141+
wait_for_backup_if_it_is_not_time_for_backup
156142
((i ++))
157143
echo -e "$(date "+%F %T") $domain" |tee -a $BACKUP/$user.log
158144
mkdir -p $tmpdir/web/$domain/conf
@@ -326,6 +312,7 @@ if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL" != '*' ]; then
326312

327313
i=0
328314
for domain in $mail_list; do
315+
wait_for_backup_if_it_is_not_time_for_backup
329316
((i ++))
330317
echo -e "$(date "+%F %T") $domain" |tee -a $BACKUP/$user.log
331318
mkdir -p $tmpdir/mail/$domain/conf
@@ -398,6 +385,7 @@ if [ ! -z "$DB_SYSTEM" ] && [ "$DB" != '*' ]; then
398385
conf="$USER_DATA/db.conf"
399386
db_list=$(echo "$db_list" |sed -e "s/ */\ /g" -e "s/^ //")
400387
for database in $db_list; do
388+
wait_for_backup_if_it_is_not_time_for_backup
401389
((i ++))
402390
get_database_values
403391

@@ -412,6 +400,19 @@ if [ ! -z "$DB_SYSTEM" ] && [ "$DB" != '*' ]; then
412400
dumpgz="$tmpdir/db/$database/$database.$TYPE.sql.gz"
413401
grants="$tmpdir/db/$database/conf/$database.$TYPE.$DBUSER"
414402
if [ ! -f "$dumpgz" ]; then
403+
404+
while true
405+
do
406+
if pgrep -x "mysqldump" > /dev/null
407+
then
408+
echo "Wait other mysqldump to finish"
409+
sleep 1
410+
else
411+
echo "We can use mysqldump now"
412+
break
413+
fi
414+
done
415+
415416
case $TYPE in
416417
mysql) dump_mysql_database ;;
417418
pgsql) dump_pgsql_database ;;
@@ -487,6 +488,8 @@ if [ "$USER" != '*' ]; then
487488
udir_list="$udir_list $udir"
488489
echo -e "$(date "+%F %T") adding $udir" |tee -a $BACKUP/$user.log
489490

491+
wait_for_backup_if_it_is_not_time_for_backup
492+
490493
# Backup files and dirs
491494
tar -cpf- $udir |gzip -$BACKUP_GZIP - > $tmpdir/user_dir/$udir.tar.gz
492495
fi

bin/v-backup-users

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ fi
2828
for user in $(grep '@' /etc/passwd |cut -f1 -d:); do
2929
check_suspend=$(grep "SUSPENDED='no'" $HESTIA/data/users/$user/user.conf)
3030
log=$HESTIA/log/backup.log
31+
if [ ! -f "$VESTA/data/users/$user/user.conf" ]; then
32+
continue;
33+
fi
34+
wait_for_backup_if_it_is_not_time_for_backup
35+
check_suspend=$(grep "SUSPENDED='no'" $VESTA/data/users/$user/user.conf)
36+
log=$VESTA/log/backup.log
3137
if [ ! -z "$check_suspend" ]; then
3238
echo -e "================================" >> $log
3339
echo -e "$user" >> $log

bin/v-list-users

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,16 @@ format=${1-shell}
1515
# JSON list function
1616
json_list() {
1717
echo '{'
18-
object_count=$(grep '@' /etc/passwd |wc -l)
1918
i=1
2019
while read USER; do
2120
source $HESTIA/data/users/$USER/user.conf
21+
if [ ! -f "$VESTA/data/users/$USER/user.conf" ]; then
22+
continue;
23+
fi
24+
if [ $i -gt 1 ]; then
25+
echo ","
26+
fi
27+
source $VESTA/data/users/$USER/user.conf
2228
echo -n ' "'$USER'": {
2329
"FNAME": "'$FNAME'",
2430
"LNAME": "'$LNAME'",
@@ -74,14 +80,8 @@ json_list() {
7480
"TIME": "'$TIME'",
7581
"DATE": "'$DATE'"
7682
}'
77-
if [ "$i" -lt "$object_count" ]; then
78-
echo ','
79-
else
80-
echo
81-
fi
8283
((i++))
8384
done < <(grep '@' /etc/passwd |cut -f1 -d:)
84-
8585
echo '}'
8686
}
8787

@@ -91,6 +91,10 @@ shell_list() {
9191
echo "---- --- --- --- --- -- ---- -- ---- ----"
9292
while read USER; do
9393
source $HESTIA/data/users/$USER/user.conf
94+
if [ ! -f "$VESTA/data/users/$USER/user.conf" ]; then
95+
continue;
96+
fi
97+
source $VESTA/data/users/$USER/user.conf
9498
echo -n "$USER $PACKAGE $U_WEB_DOMAINS $U_DNS_DOMAINS $U_MAIL_DOMAINS"
9599
echo " $U_DATABASES $U_DISK $U_BANDWIDTH $SUSPENDED $DATE"
96100
done < <(grep '@' /etc/passwd |cut -f1 -d:)
@@ -100,6 +104,10 @@ shell_list() {
100104
plain_list() {
101105
while read USER; do
102106
source $HESTIA/data/users/$USER/user.conf
107+
if [ ! -f "$VESTA/data/users/$USER/user.conf" ]; then
108+
continue;
109+
fi
110+
source $VESTA/data/users/$USER/user.conf
103111
echo -ne "$USER\t$FNAME\t$LNAME\t$PACKAGE\t$WEB_TEMPLATE\t"
104112
echo -ne "$BACKEND_TEMPLATE\t$PROXY_TEMPLATE\t$DNS_TEMPLATE\t"
105113
echo -ne "$WEB_DOMAINS\t$WEB_ALIASES\t$DNS_DOMAINS\t$DNS_RECORDS\t"
@@ -132,6 +140,10 @@ csv_list() {
132140
echo "U_CRON_JOBS,U_BACKUPS,LANGUAGE,TIME,DATE"
133141
while read USER; do
134142
source $HESTIA/data/users/$USER/user.conf
143+
if [ ! -f "$VESTA/data/users/$USER/user.conf" ]; then
144+
continue;
145+
fi
146+
source $VESTA/data/users/$USER/user.conf
135147
echo -n "$USER,\"$FNAME\",\"$LNAME\",$PACKAGE,$WEB_TEMPLATE,"
136148
echo -n "$BACKEND_TEMPLATE,$PROXY_TEMPLATE,$DNS_TEMPLATE,"
137149
echo -n "$WEB_DOMAINS,$WEB_ALIASES,$DNS_DOMAINS,$DNS_RECORDS,"
@@ -153,6 +165,11 @@ raw_list() {
153165
while read USER; do
154166
echo $HESTIA/data/users/$USER/user.conf
155167
cat $HESTIA/data/users/$USER/user.conf
168+
if [ ! -f "$VESTA/data/users/$USER/user.conf" ]; then
169+
continue;
170+
fi
171+
echo $VESTA/data/users/$USER/user.conf
172+
cat $VESTA/data/users/$USER/user.conf
156173
done < <(grep '@' /etc/passwd |cut -f1 -d:)
157174
}
158175

bin/v-update-user-stats

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ TOTAL_USERS=0
6868
# Updating user stats
6969
for user in $user_list; do
7070
USER_DATA=$HESTIA/data/users/$user
71+
if [ ! -f "$VESTA/data/users/$user/user.conf" ]; then
72+
continue;
73+
fi
74+
USER_DATA=$VESTA/data/users/$user
7175
source $USER_DATA/user.conf
7276
next_month=$(date +'%m/01/%y' -d '+ 1 month')
7377
DATE=$(date -d "$next_month -1day" +%F)

func/main.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,3 +938,24 @@ format_aliases() {
938938
aliases=$(echo "$aliases" |tr '\n' ',' |sed -e "s/,$//")
939939
fi
940940
}
941+
942+
943+
wait_for_backup_if_it_is_not_time_for_backup() {
944+
# block backup if current hour is after 6 AM
945+
WAIT_LOOP_ENTERED=0
946+
if pgrep -x "v-backup-users" > /dev/null
947+
then
948+
hour=$(date +"%H");
949+
while [ "$hour" -gt "6" ]; do
950+
if [ "$WAIT_LOOP_ENTERED" -eq 0 ]; then
951+
# do something when enter sleeping state
952+
# $BIN/v-restart-web-backend
953+
fi
954+
WAIT_LOOP_ENTERED=1
955+
current_date_time="`date "+%Y-%m-%d %H:%M:%S"`";
956+
echo "$current_date_time - wait to backup user $user - current hour is $hour";
957+
sleep 300
958+
hour=$(date +"%H");
959+
done
960+
fi
961+
}

web/edit/cron/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
exec (HESTIA_CMD."v-list-cron-job ".$user." ".$v_job." 'json'", $output, $return_var);
2424
check_return_code($return_var,$output);
2525

26-
$data = json_decode(implode('', str_replace("\\", "\\\\", $output)), true);
26+
$data = json_decode(implode('', $output), true);
2727
unset($output);
2828

2929
// Parse cron job

web/inc/i18n/es.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@
197197
'IP Addresses' => 'Direcciones IP',
198198
'Backups' => 'Respaldos',
199199
'Backup System' => 'Sistema de Respaldo',
200-
'backup exclusions' => 'configurar exlusiones',
200+
'backup exclusions' => 'configurar exclusiones',
201201
'template' => 'plantilla',
202202
'SSL Support' => 'Soportar SSL',
203203
'SSL Home Directory' => 'Directorio local del SSL',
@@ -641,9 +641,9 @@
641641
'Delete items' => 'Eliminando items',
642642
'Copy files' => 'Copiar archivos',
643643
'Move files' => 'Mover archivos',
644-
'Are you sure you want to copy' => 'Estás seguro que deseas copiar',
645-
'Are you sure you want to move' => 'Estás seguro que deseas mover',
646-
'Are you sure you want to delete' => 'Estás seguro que deseas eliminar',
644+
'Are you sure you want to copy' => 'Estás seguro de que deseas copiar',
645+
'Are you sure you want to move' => 'Estás seguro de que deseas mover',
646+
'Are you sure you want to delete' => 'Estás seguro de que deseas eliminar',
647647
'into' => 'en',
648648
'existing files will be replaced' => 'los archivos existentes serán reemplazados',
649649
'Original name' => 'Nombre original',
@@ -711,7 +711,7 @@
711711
'Disable and Cancel Licence' => 'Deshabilitar y Cancelar Licencia',
712712
'Licence Activated' => 'Licencia Activada',
713713
'Licence Deactivated' => 'Licencia Desactivada',
714-
'Restrict users so that they cannot use SSH and access only their home directory.' => 'Restringue a los usuarios para que sólo puedan ingresar a su directorio local y prohíbe el acceso a SSH.',
714+
'Restrict users so that they cannot use SSH and access only their home directory.' => 'Restringe a los usuarios para que sólo puedan ingresar a su directorio local y prohíbe el acceso a SSH.',
715715
'Browse, copy, edit, view, and retrieve all of your web domain files using fully featured File Manager.' => 'Navegar, copiar, editar, ver y descargar todos los archivos de tu página web utilizando el Administrador de Archivos.',
716716
'This is a commercial module, you would need to purchace license key to enable it.' => 'Este es un módulo comercial, tendrás que adquirir una licencia para poder activarlo.',
717717

@@ -752,15 +752,15 @@
752752
'PUB_KEY' => 'CLAVE PÚBLICA',
753753
'ISSUER' => 'EMITIDO POR',
754754

755-
'Use server hostname' => 'Usar hostname del servidor',
756-
'Use domain hostname' => 'Usar hostname del dominio',
755+
'Use server hostname' => 'Usar el nombre del servidor',
756+
'Use domain hostname' => 'Usar el dominio',
757757
'Use STARTTLS' => 'Usar STARTTLS',
758758
'Use SSL / TLS' => 'Usar SSL / TLS',
759759
'No encryption' => 'Sin encriptación',
760760
'Do not use encryption' => 'No usar encriptación',
761761

762762
'maximum characters length, including prefix' => 'usar un máximo de %s caracteres, incluyendo prefijo',
763763

764-
'Email Credentials' => 'Email Credentials',
764+
'Email Credentials' => 'Datos de acceso a la cuenta de correo',
765765

766766
);

0 commit comments

Comments
 (0)