Gitlab is now using https://gitlab.lcsb.uni.lu as it's primary address. Please update your bookmarks. FAQ.

Commit 1211e710 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

owner of the backup is changed when user exists

parent 28b62911
#! /bin/bash
BACKUP_FILE="/opt/backup/backup.tar.gz"
BACKUP_DIR="/tmp/backup/"
BACKUP_USER="borgbackup"
rm -f $BACKUP_FILE
rm -rdf $BACKUP_DIR
......@@ -30,7 +31,12 @@ pg_dump -U map_viewer map_viewer -h localhost | gzip > "$BACKUP_DIR/tmp/map_view
cd $BACKUP_DIR/tmp
tar -zcf $BACKUP_FILE *
chown backup $BACKUP_FILE
#change owner of backup file only if user exists
id -u $BACKUP_USER
status=$?
[ $status -eq 0 ] && chown $BACKUP_USER $BACKUP_FILE
cd /
rm -rf $BACKUP_DIR/tmp
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment