Skip to content

Instantly share code, notes, and snippets.

@isaacrlevin
Last active April 29, 2025 03:36
Show Gist options
  • Save isaacrlevin/b19622d35e8f174dd796247728693ac2 to your computer and use it in GitHub Desktop.
Save isaacrlevin/b19622d35e8f174dd796247728693ac2 to your computer and use it in GitHub Desktop.
Restart Jdownloader with new Glutun VPN Server on Reconnect
*/5 * * * * /home/isaac/scripts/restart-jdl.sh >> /home/isaac/scripts/restart-jdl.log 2>&1
version: "3.9"
########################### NETWORKS
networks:
socket_proxy:
external: true
traefik_proxy:
external: true
include:
- compose/$HOSTNAME/gluetun-jdl.yml
- compose/$HOSTNAME/jdownloader.yml
services:
gluetun-jdl:
image: qmcgaw/gluetun
container_name: gluetun-jdl
security_opt:
- no-new-privileges:true
restart: unless-stopped
networks:
- socket_proxy
- traefik_proxy
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun
ports:
- "5800:5800" # Exposing qBittorrent through Docker Host LAN IP
# # - 8888:8888/tcp # HTTP proxy
# # - 8388:8388/tcp # Shadowsocks
# # - 8388:8388/udp # Shadowsocks
volumes:
- $CONFIGDIR/gluetun:/gluetun
environment:
TZ: $TZ
# # OpenVPN
VPN_SERVICE_PROVIDER: nordvpn
VPN_TYPE: openvpn
OPENVPN_USER: $NORDVPN_USERNAME
OPENVPN_PASSWORD: $NORDVPN_PASSWORD
SERVER_COUNTRIES: 'United States'
labels:
- "traefik.enable=true"
## HTTP Routers
- "traefik.http.routers.gluetun-jdl-rtr.entrypoints=websecure"
- "traefik.http.routers.gluetun-jdl-rtr.rule=Host(`jdownloader.$DOMAINNAME`)" # qBittorrent
## Middlewares
- "traefik.http.routers.gluetun-jdl-rtr.middlewares=chain-oauth@file" # qBittorrent
## HTTP Services
- "traefik.http.routers.gluetun-jdl-rtr.service=gluetun-jdl-svc" # qBittorrent
- "traefik.http.services.gluetun-jdl-svc.loadbalancer.server.port=5800" # qBittorrent
services:
jdownloader:
container_name: jdownloader
security_opt:
- no-new-privileges:true
image: jlesage/jdownloader-2
restart: unless-stopped
network_mode: "service:gluetun-jdl"
volumes:
- "$CONFIGDIR/jdownloader-2:/config:rw"
- "$DATADIR/Downloads:/output:rw"
healthcheck: # https://github.com/qdm12/gluetun/issues/641#issuecomment-933856220
test: "curl -sf https://example.com || exit 1"
interval: 1m
timeout: 10s
retries: 1
#!/bin/bash
# Directory to check for the reset.lock file
DIRECTORY="/mnt/data/appdata/jdownloader-2"
LOCK_FILE="$DIRECTORY/reset.lock"
# Check if reset.lock file exists
if [ -f "$LOCK_FILE" ]; then
echo "reset.lock found. Running Docker Compose command..."
# Run Docker Compose command
docker compose -f docker-compose-Jdownloader.yml down
docker compose -f docker-compose-Jdownloader.yml up -d
# Remove the reset.lock file after the command is executed
rm -f "$LOCK_FILE"
echo "reset.lock file has been deleted."
else
echo "reset.lock not found. Nothing to do."
fi
#!/bin/sh
# Define the filename
FILE="reset.lock"
# Check if the file exists
if [ ! -f "$FILE" ]; then
# File doesn't exist, so create it
touch "$FILE"
echo "$FILE created."
else
echo "$FILE already exists."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment