Skip to content

Commit fb98418

Browse files
committed
better logic to determine if we need to archive configs
Issue #28
1 parent 475a0f0 commit fb98418

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

auto-gitlab-backup.conf.sample

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ sshKeyPath=""
1212
## $remoteServer path for gitlab backups
1313
remoteDest="/var/opt/gitlab/backups"
1414

15+
## backup gitlab configs
16+
# change to 1 to enable
17+
backupConfigs="0"
18+
1519
## set $localConfDir
1620
# blank disables conf backups
1721
# you can create /var/opt/gitlab/backups/configBackups --

auto-gitlab-backup.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ checkSize() {
7575

7676
archiveConfig() {
7777
echo ===== Archiving Configs =====
78-
if [ -w $localConfDir ]
78+
if [[ -w $localConfDir && $backupConfigs = 1 ]]
7979
then
8080
tar -czf "$localConfDir/gitlabConf-$dateStamp.tgz" $localConfig $localsshkeys
8181

8282
# remove files not within 3 days
8383
find $localConfDir -type f -mtime +3 -exec rm {} \;
8484

8585
else
86-
echo "Local configs aren't enabled or $localConfDir is not writable."
86+
echo "Local config backup aren't enabled or $localConfDir is not writable."
8787
fi
8888
}
8989

@@ -328,6 +328,7 @@ case $1 in
328328
-d|--dry-run )
329329
areWeRoot $1
330330
confFileExist
331+
archiveConfig
331332
##test ssh and rsync functions
332333
if [[ $remoteModule != "" ]]
333334
then

0 commit comments

Comments
 (0)