commit 767517929616a08c4d23b21862b6d7b27c797775 Author: Tom Date: Sun Jun 2 22:18:50 2019 +0100 initial version diff --git a/backup.sh b/backup.sh new file mode 100755 index 0000000..bfaf2d0 --- /dev/null +++ b/backup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +if [ `whoami` != 'root' ] ; then + echo "Permission Denied" + exit +fi +src=/ +dst=/media/tom/d533e3a2-c332-40e6-82a9-9a22f2dded45/Backup +args=( + --exclude /sys + --exclude /proc + --exclude /dev + --exclude /media + --exclude /mnt + --exclude /var/cache/apt/archives + --exclude '/home/*/.cache' + --exclude '/home/*/.local/share/Trash/' + --exclude '/home/*/Downloads' + --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 + + # 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 + diff --git a/status.sh b/status.sh new file mode 100755 index 0000000..4209a86 --- /dev/null +++ b/status.sh @@ -0,0 +1,2 @@ +#!/bin/bash +sudo du -hsc *