Skip to content

Commit 85260f0

Browse files
committed
optimize the script using best practice of backup policy
1 parent 90ef9f5 commit 85260f0

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

projects/LinuxSystemOps/Filesystem/rsync-and-backup-atlassian-files.sh

+13-2
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,21 @@
3434
# rsync task config
3535
################
3636
SRC="/opt/atlassian"
37-
DEST="/backup"
38-
RSYNC_LOG_FILE="/backup/atlassian-rsync.log"
37+
DEST="/backup/my-atlassian-data" # mount backup disk to /backup
38+
RSYNC_LOG_FILE="/var/log/corn-atlassian-rsync.log" # create unified log dir for log file
3939
################
4040

41+
# TODO(DingGuodong) we can send backups to oss(object store service)
42+
43+
# do this ONLY once
44+
lock_file=$SRC/.backup_lock_file # do NOT set to $DEST, make sure $DEST (backup disk) exist
45+
if [[ ! -f $lock_file ]]; then
46+
mkdir -p $DEST
47+
touch $lock_file
48+
fi
49+
50+
test ! -d $DEST && echo "backup dir not exist, disk is down? exit now." && exit 1
51+
4152
#SHELL=/bin/bash
4253
#PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
4354

0 commit comments

Comments
 (0)