1
0
Fork 0

Fix db dumps having 2 last lines filled with wrong output from cpulimit forking

This commit is contained in:
root 2022-06-12 23:56:49 +02:00
parent dd24321ac4
commit e05340dd30
1 changed files with 7 additions and 4 deletions

View File

@ -36,8 +36,10 @@ if [[ $IMGTYPE == 'postgres' ]]; then
if [[ $POSTGRES_USER != '' ]]; then
DBU='-U'${POSTGRES_USER}
fi
cpulimit -l $CLIM1 -f -- nice -n 19 docker exec -upostgres $1 \
pg_dump $DBU $DB > $TMPDIR/$1.sql
echo "nice -n 19 docker exec -upostgres $1 pg_dump $DBU $DB > $TMPDIR/$1.sql" \
> /tmp/.postgres-docker-db-dump
cpulimit -q -l $CLIM1 -f -- bash /tmp/.postgres-docker-db-dump
rm /tmp/.postgres-docker-db-dump
elif [[ $IMGTYPE == 'mariadb' || $IMGTYPE == 'mysql' ]]; then
cat <<EOLFF > /tmp/.mysql-docker-db-dump
@ -51,9 +53,10 @@ rm /docker-db-dump.sh
EOLFF
chmod +x /tmp/.mysql-docker-db-dump
docker cp /tmp/.mysql-docker-db-dump $1:/docker-db-dump.sh
echo "nice -n 19 docker exec $1 /docker-db-dump.sh > $TMPDIR/$1.sql" \
> /tmp/.mysql-docker-db-dump
cpulimit -l $CLIM1 -f -- bash /tmp/.mysql-docker-db-dump
rm /tmp/.mysql-docker-db-dump
cpulimit -l $CLIM1 -f -- nice -n 19 docker exec $1 \
/docker-db-dump.sh > $TMPDIR/$1.sql
else
echo 'FATAL: image not supported "'$IMGTYPE'"'