mirror of
https://github.com/Sonarr/Sonarr
synced 2024-12-22 15:56:58 +00:00
Created Reverse symlink script for Connect (markdown)
parent
5f0ffc69c7
commit
f8e2d6253f
1 changed files with 41 additions and 0 deletions
41
Reverse-symlink-script-for-Connect.md
Normal file
41
Reverse-symlink-script-for-Connect.md
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
Slightly updated from the Radarr version this works well if you wish to keep seeding torrents however archive them on a device across the network like a NAS.
|
||||||
|
Copy this to a folder reachable in your Docker config if necessary (i.e., create a config/connect folder) name whatever you like and ensure you chmod 777 so no issues running.
|
||||||
|
For those running with combined Torrent and Usenet downloaders it's helpful to create a 'torrent' tag for this script and also shows that are torrent eligible - this works for more obscure shows where you'd wan to minimize torrent use.
|
||||||
|
|
||||||
|
```
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
PERMPATH="$sonarr_episodefile_path"
|
||||||
|
LINKPATH="$sonarr_episodefile_sourcepath"
|
||||||
|
|
||||||
|
if [[ -f "$LINKPATH" ]]; then
|
||||||
|
sleep 1
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
# changed from Radarr as Sonarr fails on test unless exit normally
|
||||||
|
fi
|
||||||
|
|
||||||
|
ORIGFILESIZE=$(stat -c%s "$LINKPATH")
|
||||||
|
PERMFILESIZE=$(stat -c%s "$PERMPATH")
|
||||||
|
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
while [[ $PERMFILESIZE != $ORIGFILESIZE ]]; do
|
||||||
|
sleep 60
|
||||||
|
PERMFILESIZE=$(stat -c%s "$PERMPATH")
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ $PERMFILESIZE == $ORIGFILESIZE ]]; then
|
||||||
|
# Save current time stamps to prevent radarr from identifying our simlink as new, and double-processing it
|
||||||
|
LINKDIR=$(dirname "$LINKPATH")
|
||||||
|
FOLDER_DATE=$(date -r "$LINKDIR" +@%s.%N)
|
||||||
|
FILE_DATE=$(date -r "$LINKPATH" +@%s.%N)
|
||||||
|
|
||||||
|
rm "$LINKPATH"
|
||||||
|
ln -s "$PERMPATH" "$LINKPATH"
|
||||||
|
|
||||||
|
touch --no-create --no-dereference --date "$FILE_DATE" "$LINKPATH"
|
||||||
|
touch --no-create --no-dereference --date "$FILE_DATE" "$PERMPATH"
|
||||||
|
touch --no-create --no-dereference --date "$FOLDER_DATE" "$LINKDIR"
|
||||||
|
fi
|
||||||
|
```
|
Loading…
Reference in a new issue