2023-11-23 20:03:04 +01:00
|
|
|
#!/usr/bin/env bash
|
2021-05-15 21:26:22 +02:00
|
|
|
set -euo pipefail
|
|
|
|
|
2022-02-15 17:44:39 +01:00
|
|
|
user=exu
|
|
|
|
server=172.18.50.102
|
|
|
|
port=22
|
|
|
|
sshkeypath=$HOME/.ssh/id_ed25519
|
2022-11-15 17:48:53 +01:00
|
|
|
# NOTE don't transfer to the storage box directly, leads to mangled file names
|
2022-02-15 17:44:39 +01:00
|
|
|
# see: https://serverfault.com/a/765951
|
2021-05-15 21:26:22 +02:00
|
|
|
|
2022-11-21 18:33:54 +01:00
|
|
|
# unlock ssh key
|
2022-11-22 16:56:46 +01:00
|
|
|
if ! ssh-add -T "${sshkeypath}.pub" &>/dev/null; then
|
|
|
|
ssh-add -q "$sshkeypath"
|
|
|
|
fi
|
2022-11-21 18:33:54 +01:00
|
|
|
|
2024-07-23 19:57:50 +02:00
|
|
|
# Server: sync other files from audiobooks
|
2024-07-23 20:10:33 +02:00
|
|
|
rsync -uvr --progress -e "ssh -i $sshkeypath -p $port" "${user}@${server}:/mnt/media/Audiobooks" "/mnt/storage/MediaLibrary/"
|
2024-07-23 19:57:50 +02:00
|
|
|
|
2024-06-06 21:43:30 +02:00
|
|
|
# NAS: video files
|
|
|
|
rsync -uvr --progress --delete /mnt/storage/MediaLibrary/{Movies,other,Patreon,Shows} /mnt/lan1nas1/ &
|
2022-11-19 14:51:24 +01:00
|
|
|
|
2024-06-06 21:43:30 +02:00
|
|
|
# NAS: music
|
|
|
|
rsync -uvrL --progress --delete /home/exu/Musik /mnt/lan1nas1/ &
|
2022-11-15 17:48:53 +01:00
|
|
|
|
2024-07-23 19:46:27 +02:00
|
|
|
# NAS: audiobooks
|
2024-07-23 19:57:50 +02:00
|
|
|
rsync -uvrL --progress --delete "/mnt/storage/MediaLibrary/Audiobooks" /mnt/lan1nas1/ &
|
2024-07-23 19:46:27 +02:00
|
|
|
|
2024-06-06 21:43:30 +02:00
|
|
|
# Server: music
|
|
|
|
rsync -uvrL --progress --delete -e "ssh -i $sshkeypath -p $port" /home/exu/Musik/ ${user}@${server}:/mnt/media/Musik/
|
2021-05-15 21:26:22 +02:00
|
|
|
|
2024-06-06 21:43:30 +02:00
|
|
|
# Server: video files
|
|
|
|
rsync -uvr --progress --delete -e "ssh -i $sshkeypath -p $port" /mnt/storage/MediaLibrary/{Movies,Shows,other} ${user}@${server}:/mnt/media/
|
2022-04-18 15:36:06 +02:00
|
|
|
|
2024-07-23 19:46:27 +02:00
|
|
|
# Server: audiobooks
|
2024-07-23 19:57:50 +02:00
|
|
|
rsync -uvr --progress --delete -e "ssh -i $sshkeypath -p $port" "/mnt/storage/MediaLibrary/Audiobooks" "${user}@${server}:/mnt/media/"
|
2024-07-23 19:46:27 +02:00
|
|
|
|
|
|
|
# wait for background jobs
|
|
|
|
wait
|
|
|
|
|
2022-11-15 17:48:53 +01:00
|
|
|
echo "Finished transfering data"
|