Skip to content

Commit b773d7d

Browse files
committed
Add GSP_INIT_RETRY_WAIT variable
1 parent 8035050 commit b773d7d

File tree

2 files changed

+4
-1
lines changed
  • root/etc/s6-overlay/s6-rc.d/svc-mod-gluetun-sync-port

2 files changed

+4
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ The following env variables can be used to configure the mod (all are optional)
3333
| `GSP_QBT_PASSWORD_FILE`| | Qbittorrent password file (for [docker secret](https://docs.docker.com/compose/use-secrets/) use). This supplants `GSP_QBT_PASSWORD`. |
3434
| `GSP_SKIP_INIT_CHECKS` | `false` | Set to `true` to disable qbt config checks ("Bypass authentication on localhost", etc). Set to `warning`to see check results but continue anyway.|
3535
| `GSP_MINIMAL_LOGS` | `true` | Set to `false` to enable "Ports did not change." logs. |
36+
| `GSP_INIT_RETRY_WAIT` | `10` (=60s) | Number of retries to connect to qbittorrent's webUI at startup. Each retry takes 6 seconds. Increase to allow a longer wait at startup. |
3637
| `GSP_DEBUG` | `false` | Set to `true` to enable mod's `set -x`.<br>:warning: **FOR DEBUG ONLY.** |
3738

3839
I was planning on implementing the option to use Gluetun's port forwarding file but since it will be [deprecated in v4](https://github.com/qdm12/gluetun-wiki/blob/main/setup/advanced/vpn-port-forwarding.md#native-integrations), I won't.

root/etc/s6-overlay/s6-rc.d/svc-mod-gluetun-sync-port/run

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
MAX_SLEEP_TIME="${GSP_SLEEP:-60}"
77
RETRY_DELAY="${GSP_RETRY_DELAY:-10}"
8+
INIT_RETRY_WAIT="${GSP_INIT_RETRY_WAIT:-10}"
89
[ "${MAX_SLEEP_TIME}" -eq "${RETRY_DELAY}" ] && (( RETRY_DELAY = RETRY_DELAY - 1 )) # To avoid errors later
910
GLUETUN="${GSP_GTN_ADDR:-http://localhost:8000}"
1011
QBITTORRENT="${GSP_QBT_ADDR:-http://localhost:${WEBUI_PORT:-8080}}"
@@ -122,7 +123,8 @@ fi
122123

123124

124125
log "Waiting for Qbittorrent WebUI ..."
125-
curl --retry 10 --retry-all-errors --retry-delay 6 -s -o /dev/null "${QBITTORRENT}"
126+
curl --retry "${INIT_RETRY_WAIT}" --retry-all-errors --retry-delay 6 -s -o /dev/null "${QBITTORRENT}" || \
127+
log "Couldn't connect to webUI. Check the address, or maybe your instance is taking to long to start. You can adjust the GSP_INIT_RETRY_WAIT variable to wait longer."
126128

127129

128130
init_checks

0 commit comments

Comments
 (0)