add basic music library sync check script

This commit is contained in:
chaos 2024-03-10 18:27:22 +00:00
parent 94eb79d5c6
commit dd4bc277d1
No known key found for this signature in database

View file

@ -21,6 +21,29 @@ in {
'')
];
home.file."Music/music-sync-check.sh" = {
executable = true;
text = ''
#!/usr/bin/env bash
SCRIPT_DIR=$( cd -- "$( dirname -- "''${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd "''${SCRIPT_DIR}"
ERROR_LOG=$(mktemp -t music-check-log-XXX)
echo "Checking StorageBox sync status"
if rclone check . Storage:Music --exclude "/*.sh" 2>$ERROR_LOG; then
echo "Up to date with StorageBox"
else
echo "An error occured attempting to check sync status:"
cat "$ERROR_LOG"
echo
fi
rm "$ERROR_LOG"
'';
};
home.file."Music/music-sync.sh" = {
executable = true;
text = ''
@ -29,7 +52,7 @@ in {
SCRIPT_DIR=$( cd -- "$( dirname -- "''${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd "''${SCRIPT_DIR}"
rclone sync -P . Storage:Music --exclude music-sync.sh,music-download.sh
rclone sync -P . Storage:Music --exclude "/*.sh"
restic-music backup $(fd -t d --max-depth=1 && fd -t f --max-depth=1)
TITLE="chaos's Music Library"