From 49ba758c951d373b25836e95a21d1d42be695847 Mon Sep 17 00:00:00 2001 From: home Date: Tue, 28 Nov 2023 02:15:24 +0300 Subject: [PATCH] backup : add checksum_create for tmp media. --- app/bin/home/backup | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/app/bin/home/backup b/app/bin/home/backup index 7bb364e..b4ab1d9 100755 --- a/app/bin/home/backup +++ b/app/bin/home/backup @@ -1,6 +1,9 @@ #!/bin/bash -source /var/roothome/app/bin/home/shared.sh +# TODO: Rewrite me, maybe? <3 + +source /var/roothome/.config/bash/module/notify.sh +source /var/roothome/.config/bash/module/checksum.sh dow=$(/usr/bin/date +%u) # current day of week number. date=$(/usr/bin/date +%Y%m%d%H%M) # date stamp. @@ -38,11 +41,17 @@ builtin cd "$path_src" rm $path_docker/${dow}_*.tgz /usr/bin/tar --exclude-from=docker/.tarignore -c docker | /usr/bin/gzip -1 > $path_docker/docker.tgz && mv $path_docker/docker.tgz $path_docker/${dow}_${date}-$(/usr/bin/sha1sum $path_docker/docker.tgz | cut -d\ -f1).tgz || notify 'backup : docker failed' +# Update checksums. +cd /var/mnt/storage/hot/media/book/ && checksum_create || notify 'Backup : checksum book failed.' +cd /var/mnt/storage/hot/media/music/ && checksum_create || notify 'Backup : checksum book failed.' +cd /var/mnt/storage/hot/media/paper/ && checksum_create || notify 'Backup : checksum book failed.' + # copy media. -/usr/bin/rsync -a --delete /var/mnt/storage/hot/media/book/ /var/mnt/backup/backup/tmp/book/ || notify 'backup : copy book failed' -/usr/bin/rsync -a --delete /var/mnt/storage/hot/media/music/ /var/mnt/backup/backup/tmp/music/ || notify 'backup : copy music failed' -/usr/bin/rsync -a --delete /var/mnt/storage/hot/media/paper/ /var/mnt/backup/backup/tmp/paper/ || notify 'backup : copy paper failed' -/usr/bin/rsync -a --delete /var/mnt/storage/hot/media/porn/ /var/mnt/backup/backup/tmp/porn/ || notify 'backup : copy porn failed' +/usr/bin/rsync -a --delete /var/mnt/storage/hot/media/book/ /var/mnt/backup/backup/tmp/book/ || notify 'backup : copy book failed' +/usr/bin/rsync -a --delete /var/mnt/storage/hot/media/music/ /var/mnt/backup/backup/tmp/music/ || notify 'backup : copy music failed' +/usr/bin/rsync -a --delete /var/mnt/storage/hot/media/paper/ /var/mnt/backup/backup/tmp/paper/ || notify 'backup : copy paper failed' +/usr/bin/rsync -a --delete /var/mnt/storage/hot/media/porn/ /var/mnt/backup/backup/tmp/porn/ || notify 'backup : copy porn failed' +/usr/bin/rsync -a --delete /var/mnt/storage/cold_2/media/youtube/best/ /var/mnt/backup/backup/tmp/youtube/ || notify 'backup : copy youtube failed' # upload external. #/usr/bin/rsync -ahP -e 'ssh -p 143 -i /var/roothome/document/key/ssh/pi.key' /var/mnt/backup/ root@192.168.1.6:/var/mnt/backup/ || notify 'backup : failed upload'