Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Piotr Gawron
minerva-scripts
Commits
1211e710
Commit
1211e710
authored
Jan 07, 2020
by
Piotr Gawron
Browse files
owner of the backup is changed when user exists
parent
28b62911
Changes
1
Hide whitespace changes
Inline
Side-by-side
server/backup.sh
View file @
1211e710
#! /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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment