tidy formatting
This commit is contained in:
parent
7675179296
commit
734129e09e
25
backup.sh
Executable file → Normal file
25
backup.sh
Executable file → Normal file
@ -3,6 +3,7 @@ if [ `whoami` != 'root' ] ; then
|
|||||||
echo "Permission Denied"
|
echo "Permission Denied"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
src=/
|
src=/
|
||||||
dst=/media/tom/d533e3a2-c332-40e6-82a9-9a22f2dded45/Backup
|
dst=/media/tom/d533e3a2-c332-40e6-82a9-9a22f2dded45/Backup
|
||||||
args=(
|
args=(
|
||||||
@ -18,17 +19,17 @@ args=(
|
|||||||
--exclude /storage
|
--exclude /storage
|
||||||
)
|
)
|
||||||
|
|
||||||
# do a backup
|
# do a backup
|
||||||
touch $dst/next.log
|
touch $dst/next.log
|
||||||
tail -n0 --pid="$$" -f $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
|
rsync "${args[@]}" -av --link-dest=$dst/current $src/ $dst/next 2>&1 >> $dst/next.log || exit
|
||||||
|
|
||||||
# success, clean up
|
# success, clean up
|
||||||
date=`date "+%Y-%m-%dT%H:%M:%S"`
|
date=`date "+%Y-%m-%dT%H:%M:%S"`
|
||||||
mv $dst/next $dst/$date
|
mv $dst/next $dst/$date
|
||||||
mv $dst/next.log $dst/$date.log
|
mv $dst/next.log $dst/$date.log
|
||||||
unlink $dst/current
|
unlink $dst/current
|
||||||
unlink $dst/current.log
|
unlink $dst/current.log
|
||||||
ln -s $dst/$date $dst/current
|
ln -s $dst/$date $dst/current
|
||||||
ln -s $dst/$date.log $dst/current.log
|
ln -s $dst/$date.log $dst/current.log
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user