tidy formatting

This commit is contained in:
James 2019-06-04 21:39:41 +01:00
parent 7675179296
commit 734129e09e

25
backup.sh Executable file → Normal file
View File

@ -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