This is a bash script written to assist in moving content from one linux based machine to another. This solution utilizes the “Atomic Transfers” needed to ensure that destination utilities (Sonarr, Radarr, etc) do not move partially transferred files too early.
I have a seedbox running in the cloud, and a Plex server running separately with Sonarr/Radarr/etc on it. When new files are downloaded, I want the script to strip out everything but the video file. If the file is in a RAR, extract it first. Once it has staged the files, it will use RSync to push them to my remote server where Sonarr/Radarr can grab and file away.
- Install Rsync Daemon on the destination server.
- Rsync Man Page: https://linux.die.net/man/1/rsync
- Terrific Resource on how to set up the Daemon: https://www.atlantic.net/vps-hosting/how-to-setup-rsync-daemon-linux-server/
- Ensure you follow the steps to create a username and password file on the destination server
- Create the ExtractAndTransfer file on the originating server, typically as ExtractAndTransfer.sh, and ensure that it is executable with
chmod +x ExtractAndTransfer.sh
- Create a file for your Rsync Password on the originating server, typically named rsync_pass and located with the ExtrctAndTransfer.sh file. This file should contain only the password, nothing else. Ensure you
chmod 600 rsync_pass
if this is a shared server. - Go through the ExtractAndTransfer.sh variables to ensure that your path names and variable names match your environment (IE:
rsync_pass="/your/location/rsync_pass"
should be updated to the correct path)