Compare commits

..

2 Commits

Author SHA1 Message Date
daa014c4e8 latest 2022-12-10 02:36:52 +01:00
f032025956 latest 2022-12-10 02:36:30 +01:00
5 changed files with 100 additions and 3 deletions

View File

@ -0,0 +1,26 @@
TARGET := ./berlin.sneak.fs.NNNY-cyberdyne-backup-01
default: backup
backup: do_file_backup write_checksum
write_checksum:
cd $(TARGET)/fs && find . -type f -print0 | xargs -0 sha1sum > ../.SHASUMS.tmp
mv ./.SHASUMS.tmp ./$(TARGET)/SHASUMS.txt
#--exclude=/tmp \
do_file_backup:
rsync -avP \
--exclude=/.cache \
--exclude=/.nvm \
--exclude=/.Trash \
--exclude=/Library/Caches \
--exclude=/Library/Mail \
--exclude=/Library/Developer \
--exclude=.DS_Store \
--delete-before \
--delete-excluded \
$(HOME)/ $(TARGET)/fs/
echo '# $(shell date -u)' > $(TARGET)/lastbackup.txt
date -u '+%s' >> $(TARGET)/lastbackup.txt

View File

@ -22,7 +22,7 @@ LOGDIR="$HOME/Documents/_SYSADMIN/$YYYY-$MM/$YYYYMMDD"
if [[ ! -d "$LOGDIR" ]]; then
mkdir -p "$LOGDIR"
fi
#exec > >(tee -a $LOGDIR/$YYYYMMDD.$(date -u +%s).tocloud-backup.log) 2>&1
exec > >(tee -a $LOGDIR/$YYYYMMDD.$(date -u +%s).tocloud-backup.log) 2>&1
function on_exit {
rm -rf "$TD"
@ -120,10 +120,10 @@ function do_backup {
rclone sync \
--retries 99999 \
--progress \
--progress-terminal-title \
--stats-unit bits \
--stats-one-line -v \
"$TD/$BACKUPNAME" \
fsn1-storagebox-10T:"$BACKUPNAME"/
fsn1-storagebox-10T:"$BACKUPNAME"/ 2>&1
# belt and suspenders
echo "### Verifying uploaded data checksums..."
rsync -acP "$TD/$BACKUPNAME/" fsn1-storagebox-10T:"$BACKUPNAME"/

22
import-video/import.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
DEST="/Volumes/video"
D="root@las1"
function main() {
if [[ ! -d "$DEST/2022" ]]; then
echo "wrong box" > /dev/stderr
exit 1
fi
SRC="$1"
cd "$SRC"
for FILE in * ; do
YYYY="$(echo "$FILE" | colrm 5)"
MM="$(echo "$FILE" | colrm 1 4 | colrm 3)"
DD="$(echo "$FILE" | colrm 1 6 | colrm 3)"
echo "ssh $D -- mkdir -p /storage/video/$YYYY/$YYYY-$MM/$YYYY-$MM-$DD"
echo "rsync -acvvvP \"$SRC/$FILE\" $D:/storage/video/$YYYY/$YYYY-$MM/$YYYY-$MM-$DD/"
done
}
main $*

View File

@ -42,6 +42,7 @@ RE+=" --exclude=.cache/"
RE+=" --exclude=/.cpan/build/"
RE+=" --exclude=/.cpan/sources/"
RE+=" --exclude=/.docker/"
RE+=" --exclude=/.local/share/containers/podman/machine/"
RE+=" --exclude=/.dropbox/"
RE+=" --exclude=/.minikube/cache/"
RE+=" --exclude=/Applications/Fortnite/"
@ -59,6 +60,7 @@ RE+=" --exclude=/Library/Application?Support/SecondLife/cache/"
RE+=" --exclude=/Library/Application?Support/Steam/SteamApps/"
RE+=" --exclude=/Library/Application?Support/SyncServices/"
RE+=" --exclude=/Library/Application?Support/protonmail/bridge/cache"
RE+=' --exclude=/Library/Application?Support/Syncthing/index-*'
RE+=" --exclude=/Library/Metadata"
RE+=" --exclude=/Library/Caches/"
RE+=" --exclude=/Library/Containers/com.docker.docker/"
@ -79,6 +81,8 @@ RE+=" --exclude=/Library/Syncthing/folders/" # syncthing is its own backup
RE+=" --exclude=/Library/VoiceTrigger/SAT"
RE+=" --exclude=/Library/iTunes/iPad?Software?Updates/"
RE+=" --exclude=/Library/iTunes/iPhone?Software?Updates/"
RE+=" --exclude=/Movies/CacheClip/"
RE+=" --exclude=/Movies/ProxyMedia/"
RE+=" --exclude=/Music/iTunes/Album?Artwork/"
RE+=" --exclude=/Pictures/iPod?Photo?Cache/"
RE+=" --exclude=/Receivd/"

45
photoimport/photoimport Executable file
View File

@ -0,0 +1,45 @@
#!/usr/bin/env zsh
set -x
set -e
set -o nullglob
YYYYMMDD="$(date "+%Y-%m-%d")"
function downloadPhotos() {
SRC=(/Volumes/*/DCIM)
if [[ ! -d "$SRC" ]]; then
echo "no photos" > /dev/stderr
return
fi
DST="$HOME/Library/Syncthing/folders/LightroomMasters-CurrentYear/toimport"
du -sh "$SRC"
rsync -ah --no-inc-recursive --info=progress2 --remove-source-files "$SRC"/ $DST/$YYYYMMDD/
cd "$DST/$YYYYMMDD"
mv */* .
f2 -r '../{{mtime.YYYY}}/{{mtime.YYYY}}-{{mtime.MM}}/{{mtime.YYYY}}-{{mtime.MM}}-{{mtime.DD}}/{{mtime.YYYY}}-{{mtime.MM}}-{{mtime.DD}}.{{x.model}}.{{f}}.{{hash.sha256}}{{ext}}' -x --verbose
}
function downloadVideos() {
SRC=(/Volumes/*/PRIVATE/M4ROOT/CLIP)
if [[ ! -d "$SRC" ]]; then
echo "no videos" > /dev/stderr
return
fi
DST="$HOME/_TODO/$YYYYMMDD-video-import/"
mkdir -p "$DST"
du -sh "$SRC"
rsync -ah --no-inc-recursive --info=progress2 --remove-source-files "$SRC"/ $DST/
cd "$DST"
#mv */* .
f2 -r '{{mtime.YYYY}}/{{mtime.YYYY}}-{{mtime.MM}}/{{mtime.YYYY}}-{{mtime.MM}}-{{mtime.DD}}/{{mtime.YYYY}}-{{mtime.MM}}-{{mtime.DD}}.{{f}}.{{hash.sha256}}{{ext}}' -x --verbose
}
function main() {
# FIXME this doesn't work if there are no photos on the card but the
# DCIM dir exists
downloadPhotos
downloadVideos
}
main