configs/arch-config/scripts/in_path/sc-jellyfin-update
2024-03-22 22:35:52 +01:00

38 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
user=exu
server=172.18.50.102
port=22
sshkeypath=$HOME/.ssh/id_ed25519
# NOTE don't transfer to the storage box directly, leads to mangled file names
# see: https://serverfault.com/a/765951
# unlock ssh key
if ! ssh-add -T "${sshkeypath}.pub" &>/dev/null; then
ssh-add -q "$sshkeypath"
fi
# transfer to nas
rsync -uvr --progress --delete /mnt/storage/MediaLibrary/{Movies,other,Patreon,Shows} /mnt/lan1nas1/
# Music to NAS. Leading source is main PC
rsync -uvrL --progress --delete /home/exu/Musik /mnt/lan1nas1/
# transfer Music
rsync -uvr --progress --delete --bwlimit=2M -e "ssh -i $sshkeypath -p $port" /mnt/lan1nas1/Musik/ ${user}@${server}:/mnt/media/Musik/
# transfer Shows
rsync -uvr --progress --delete --bwlimit=2M -e "ssh -i $sshkeypath -p $port" /mnt/lan1nas1/Shows/ ${user}@${server}:/mnt/media/Shows/
# transfer Movies
rsync -uvr --progress --delete --bwlimit=2M -e "ssh -i $sshkeypath -p $port" /mnt/lan1nas1/Movies/ ${user}@${server}:/mnt/media/Movies/
# transfer other
rsync -uvr --progress --delete --bwlimit=2M -e "ssh -i $sshkeypath -p $port" /mnt/lan1nas1/other/ ${user}@${server}:/mnt/media/other/
# transfer downloaded YouTube videos
#rsync -uvr --progress --delete --bwlimit=2M -e "ssh -i $sshkeypath -p $port" /mnt/lan1nas1/YouTube/ ${user}@${server}:/mnt/media/YouTube/
echo "Finished transfering data"