From 734129e09e58e7daec2daec155b63096b678c779 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 4 Jun 2019 21:39:41 +0100 Subject: [PATCH] tidy formatting --- backup.sh | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) mode change 100755 => 100644 backup.sh diff --git a/backup.sh b/backup.sh old mode 100755 new mode 100644 index bfaf2d0..8d198e7 --- a/backup.sh +++ b/backup.sh @@ -3,6 +3,7 @@ if [ `whoami` != 'root' ] ; then echo "Permission Denied" exit fi + src=/ dst=/media/tom/d533e3a2-c332-40e6-82a9-9a22f2dded45/Backup args=( @@ -18,17 +19,17 @@ args=( --exclude /storage ) - # do a backup - touch $dst/next.log - tail -n0 --pid="$$" -f $dst/next.log & - rsync "${args[@]}" -av --link-dest=$dst/current $src/ $dst/next 2>&1 >> $dst/next.log || exit +# do a backup +touch $dst/next.log +tail -n0 --pid="$$" -f $dst/next.log & +rsync "${args[@]}" -av --link-dest=$dst/current $src/ $dst/next 2>&1 >> $dst/next.log || exit - # success, clean up - date=`date "+%Y-%m-%dT%H:%M:%S"` - mv $dst/next $dst/$date - mv $dst/next.log $dst/$date.log - unlink $dst/current - unlink $dst/current.log - ln -s $dst/$date $dst/current - ln -s $dst/$date.log $dst/current.log +# success, clean up +date=`date "+%Y-%m-%dT%H:%M:%S"` +mv $dst/next $dst/$date +mv $dst/next.log $dst/$date.log +unlink $dst/current +unlink $dst/current.log +ln -s $dst/$date $dst/current +ln -s $dst/$date.log $dst/current.log