1
0
mirror of https://github.com/vaniacer/DDT.git synced 2024-11-21 17:06:31 +02:00

add rsync speed limit

This commit is contained in:
Vaniac 2020-08-19 10:26:04 +03:00
parent 84b32b9f27
commit dcd631835d

5
ddt.sh
View File

@ -1,5 +1,4 @@
#!/bin/bash
dbases=(
#-----------------+---------------------------+---------------------------+-------------+---------------------------+
# Ssh alias(addr) | Dump folder(bkpath) |Dump search pattern(dbname)|Dump ext\type|Unique test DB name(dbtest)|
@ -22,7 +21,7 @@ dbport=5432 # DB server port
dbuser=dbuser # User of test DB server
dbpass=password # DB user password
dbconf="-U $dbuser -h $dbhost -p $dbport" # DB connection parameters
slimit= # Rsync speed limit
dmeror=(''
' ___ __ __ ___ _ \n'
'| \ \/ | _ \ ___ __| |_ \n'
@ -59,7 +58,7 @@ dberor=(''
download () {
rerr=
for j in {0..9}; {
rerr=$(rsync -Pqz $addr:"$bkpath/$dump" "$dmpdir/$localdump" 2>&1 > /dev/null) \
rerr=$(rsync --bwlimit=$slimit -Pqz $addr:"$bkpath/$dump" "$dmpdir/$localdump" 2>&1 > /dev/null) \
&& { printf "\nDownload complete.\n"; return 0; } \
|| sleep 5
}