qbittorrent custom port forward script

This commit is contained in:
2024-11-27 11:32:58 -05:00
parent 5fca036b85
commit b789ac12ed
3 changed files with 35 additions and 3 deletions

View File

@@ -47,6 +47,10 @@ spec:
mountPath: /config/wg_confs
- name: wireguard-config
mountPath: /config
- name: natpmp-script
mountPath: /custom-services.d/natpmp.sh
subPath: natpmp.sh
readOnly: true
volumes:
- name: qbittorrent-config
persistentVolumeClaim:
@@ -60,3 +64,6 @@ spec:
- name: wireguard-config-secret
secret:
secretName: wireguard-config-secret
- name: natpmp-script
configMap:
name: natpmp-script

View File

@@ -0,0 +1,25 @@
apiVersion: v1
data:
natpmp.sh: |
#!/bin/sh
while true; do
date
# Run natpmpc for UDP and TCP, redirect output to a temporary file
natpmpc -a 1 0 udp 60 -g 10.2.0.1 && natpmpc -a 1 0 tcp 60 -g 10.2.0.1 > /tmp/natpmpc_output || {
echo -e "ERROR with natpmpc command \a"
break
}
# Extract the port numbers from the output and save them in variables
port=$(grep 'TCP' /tmp/natpmpc_output | grep -o 'Mapped public port [0-9]*' | awk '{print $4}')
echo "Opened port: $port"
sleep 45
done
kind: ConfigMap
metadata:
creationTimestamp: null
name: natpmp-script
namespace: media

View File

@@ -7,6 +7,6 @@ data:
PUID: "1000"
GUID: "1000"
TZ: America/Toronto
DOCKER_MODS: ghcr.io/fusetim/external_natpmp_qbittorrent:ecf567b21e5f079762e36c9cee9afaf86fcb22be
# DOCKER_MODS: linuxserver/mods:universal-package-install
# INSTALL_PACKAGES: libnatpmp
DOCKER_MODS: linuxserver/mods:universal-package-install
INSTALL_PACKAGES: libnatpmp
# DOCKER_MODS: ghcr.io/fusetim/external_natpmp_qbittorrent:ecf567b21e5f079762e36c9cee9afaf86fcb22be