2021-05-15 21:26:22 +02:00
|
|
|
#!/bin/bash
|
|
|
|
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
|
|
|
|
2022-11-19 14:51:24 +01:00
|
|
|
# transfer to nas
|
2022-11-23 19:48:05 +01:00
|
|
|
#rsync -uvr --progress /mnt/storage/MediaLibrary/{Movies,other,Patreon,Shows,YouTube} /mnt/lan1nas1/
|
2023-07-15 12:42:35 +02:00
|
|
|
rsync -uvr --progress --delete /mnt/storage/MediaLibrary/{Movies,other,Patreon,Shows,YouTube} /mnt/lan1nas1/
|
2022-11-19 14:51:24 +01:00
|
|
|
|
2022-12-02 17:28:54 +01:00
|
|
|
# Music to NAS. Leading source is main PC
|
|
|
|
rsync -uvrL --progress --delete /home/marc/Musik /mnt/lan1nas1/
|
2022-11-15 17:48:53 +01:00
|
|
|
|
2022-02-15 17:44:39 +01:00
|
|
|
# transfer Music
|
2022-11-19 14:51:24 +01:00
|
|
|
#rsync -uvrL --progress --bwlimit=4M -e "ssh -i $sshkeypath -p $port" /home/marc/Musik/ ${user}@${server}:/mnt/media/Musik/
|
2022-12-01 20:48:13 +01:00
|
|
|
rsync -uvr --progress --delete --bwlimit=2M -e "ssh -i $sshkeypath -p $port" /mnt/lan1nas1/Musik/ ${user}@${server}:/mnt/media/Musik/
|
2021-05-15 21:26:22 +02:00
|
|
|
|
2022-02-15 17:44:39 +01:00
|
|
|
# transfer Shows
|
2022-11-19 14:51:24 +01:00
|
|
|
#rsync -uvr --progress --bwlimit=4M -e "ssh -i $sshkeypath -p $port" /mnt/storage/MediaLibrary/Shows/ ${user}@${server}:/mnt/media/Shows/
|
2022-12-01 20:48:13 +01:00
|
|
|
rsync -uvr --progress --delete --bwlimit=2M -e "ssh -i $sshkeypath -p $port" /mnt/lan1nas1/Shows/ ${user}@${server}:/mnt/media/Shows/
|
2021-05-15 21:26:22 +02:00
|
|
|
|
2022-02-15 17:44:39 +01:00
|
|
|
# transfer Movies
|
2022-11-19 14:51:24 +01:00
|
|
|
#rsync -uvr --progress --bwlimit=4M -e "ssh -i $sshkeypath -p $port" /mnt/storage/MediaLibrary/Movies/ ${user}@${server}:/mnt/media/Movies/
|
2022-12-01 20:48:13 +01:00
|
|
|
rsync -uvr --progress --delete --bwlimit=2M -e "ssh -i $sshkeypath -p $port" /mnt/lan1nas1/Movies/ ${user}@${server}:/mnt/media/Movies/
|
2022-04-18 15:36:06 +02:00
|
|
|
|
|
|
|
# transfer other
|
2022-11-19 14:51:24 +01:00
|
|
|
#rsync -uvr --progress --bwlimit=4M -e "ssh -i $sshkeypath -p $port" /mnt/storage/MediaLibrary/other/ ${user}@${server}:/mnt/media/other/
|
2022-12-01 20:48:13 +01:00
|
|
|
rsync -uvr --progress --delete --bwlimit=2M -e "ssh -i $sshkeypath -p $port" /mnt/lan1nas1/other/ ${user}@${server}:/mnt/media/other/
|
2022-04-18 15:36:06 +02:00
|
|
|
|
|
|
|
# transfer downloaded YouTube videos
|
2022-11-19 14:51:24 +01:00
|
|
|
#rsync -uvr --progress --bwlimit=4M -e "ssh -i $sshkeypath -p $port" /mnt/storage/MediaLibrary/YouTube/ ${user}@${server}:/mnt/media/YouTube/
|
2023-02-01 20:54:43 +01:00
|
|
|
rsync -uvr --progress --delete --bwlimit=2M -e "ssh -i $sshkeypath -p $port" /mnt/lan1nas1/YouTube/ ${user}@${server}:/mnt/media/YouTube/
|
2022-11-15 17:48:53 +01:00
|
|
|
|
|
|
|
# NOTE wait to make sure the transfer to the nas is complete as well
|
|
|
|
# https://stackoverflow.com/a/41791336
|
2022-11-19 14:51:24 +01:00
|
|
|
#wait
|
2022-11-15 17:48:53 +01:00
|
|
|
|
|
|
|
echo "Finished transfering data"
|