backup : add checksum_create for tmp media.

This commit is contained in:
Dmitry Voronin 2023-11-28 02:15:24 +03:00
parent 9070f06e17
commit 49ba758c95

View file

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