Just got my setup done with protonvpn and figured I'd share in case it'll help someone in the future.
These are effectively modified from the ones posted by a reddit user here to be compatible with this docker container and unraid.
I have the 2 scripts in a folder on the docker container and I'm calling them with the User Scripts plugin due to a lack of embedded cron functionality in the arch docker images.
First script is called proton-get-port.sh and runs the while true loop to keep the port forwarded:
#if pgrep -f proton-get-port.sh >/dev/null; then
# echo "Script is already running, doing nothing."
# exit 1
#fi
#edit - this doesn't work. It always detects itself on startup. See below for inbuilt functionality of this.
natpmpc -a 1 0 udp 60 -g 10.2.0.1 # Ask for UDP port forwarding
natpmpc -a 1 0 tcp 60 -g 10.2.0.1 | grep -oP 'Mapped public port \K\d+' > /data/protonvpn-port
echo "Port written to protonvpn-port file"
cat /data/protonvpn-port
while true ; do date ; date > /data/timecheck ; natpmpc -a 1 0 udp 60 -g 10.2.0.1 && natpmpc -a 1 0 tcp 60 -g 10.2.0.1 || { echo -e "ERROR with natpmpc command \a" ; break ; } ; sleep 45 ; done
Second is for updating deluge manually. Be sure to replace the username and password for deluge from below:
port=`cat /data/protonvpn-port` # retrieve the port from the file
echo "Port found in file :"
echo $port
deluge-console "connect 127.0.0.1:58846 USERNAME USERPASSWORD; config -s random_port false; config -s listen_ports ($port, $port)" & # Update deluge's incoming port in the background
I then use User Scripts to call them. I run the proton-get-port.sh every hour and the deluge one every 6 hours, but modify to your liking. The if statement in the proton script will prevent you from double instancing it.
User Scripts calls
proton-get-port.sh:
docker exec -i <DOCKER_CONTAINER_ID> sh ./data/proton-get-port.sh
deluge-port.sh:
docker exec <DOCKER_CONTAINER_ID> sh ./data/deluge-port.sh