feat: print time at start of backup

This commit is contained in:
Michael Mandl 2023-08-19 12:03:58 +02:00
parent 160437f93e
commit 90890fb5d3
Signed by: mandlm
GPG key ID: 4AA25D647AA54CC7

View file

@ -1,10 +1,24 @@
#!/bin/bash #!/bin/bash
echo "Running backup at $(date)"
if [[ -v KOPIA_PG_DATABASE ]]; if [[ -v KOPIA_PG_DATABASE ]];
then then
echo "Dumping database ${KOPIA_PG_DATABASE}"
PGPASSWORD=$KOPIA_PG_PASSWORD pg_dump --host=$KOPIA_PG_HOST --username=$KOPIA_PG_USER $KOPIA_PG_DATABASE > /backup/database/$KOPIA_PG_DATABASE.sqldump || exit 1 PGPASSWORD=$KOPIA_PG_PASSWORD pg_dump --host=$KOPIA_PG_HOST --username=$KOPIA_PG_USER $KOPIA_PG_DATABASE > /backup/database/$KOPIA_PG_DATABASE.sqldump || exit 1
fi fi
if [[ -v KOPIA_FTP_HOST ]];
then
echo "Downloading from ftp server ${KOPIA_FTP_HOST}"
lftp -u "$KOPIA_FTP_USER","$KOPIA_FTP_PASSWORD" $KOPIA_FTP_HOST <<EOF
set ssl:verify-certificate no
mirror --delete --parallel=4 --use-pget-n=10 / /backup/ftp;
exit
EOF || exit 1
fi
kopia repository connect filesystem \ kopia repository connect filesystem \
--path /repository \ --path /repository \
--override-hostname ${KOPIA_HOSTNAME} \ --override-hostname ${KOPIA_HOSTNAME} \