How to restart qbittorrent container every x hours automatically

  • I get the same exact issue with gluetun! Such a pain in the ass though sometimes mine will not come back up.


    The only way I can see accomplishing this would be having a down connection trigger some custom code that renames another server .conf file to wg0.conf



    I couldn't get the webserver to come up on failure without adding nginx and changing what Dockerfile's CMD pointed at _AND_ adding exec commands to various files. I did get it t work with nginx, but I gave up when trying to use the supplied python core to remove the addition of nginx. Since I didn't want to do half of that, I consider my modifications trash.


    I did write a script to rotate confs. Although it can rotate regular files too, the comments/references are oriented at the usage with this container. There's a limited test file as well (~65% coverage).


    Note: the zip comes with a supplied "start.sh", but that also adds 3 lines that create a "vpn_down" file when the vpn is seemingly down and deletes it on a successful health check.


    Usage:

  • I came across this thread looking for a way to automatically restart qbittorrent when gluetun was reset and the qbittorrent/vpn container that was suggested wouldn't work for me. The use case I have with Gluetun, is that it offers a single VPN connection for multiple things. I can run web traffic through it along with any docker containers without having multiple VPN connections to my provider.


    Here's the solution I found for qbittorrent and gluetun:

    I'm already running willfarrell/autoheal to restart gluetun when it transitions to unhealthy status since gluetun has a built in health check. The issue with qbittorrent is that it can't handle when gluetun is restarted and qbittorrent doesn't have a health check. The easiest way I've found is to manually add a health check to qbittorrent in the docker compose file. So, when qbittorrent is unhealthy it will also be restarted.


    Here's what you can add to the qbittorrent section in your docker compose file.

    Code
        healthcheck:
          test: ping -c 1 www.google.com || exit 1
          interval: 1m
          timeout: 10s
          retries: 1


    Here's the log from docker-autoheal:


    Code
    26-09-2023 09:43:39 Container /gluetun (f374089cb2cc) found to be unhealthy - Restarting container now with 10s timeout
    
    26-09-2023 09:44:26 Container /qbit (2a05b1ee4400) found to be unhealthy - Restarting container now with 10s timeout
  • Here's the solution I found for qbittorrent and gluetun:

    Are you sure that is utilizing the VPN for the kill switch? I thought I read that the health check will be ran by the docker process globally and not as the client software, thus that ping will always pass if there's a internet connection on the host system (or at least available to the docker process).

  • Are you sure that is utilizing the VPN for the kill switch? I thought I read that the health check will be ran by the docker process globally and not as the client software, thus that ping will always pass if there's a internet connection on the host system (or at least available to the docker process).


    I'm a bit confused by what your saying. All networking from the qbittorrent container goes through gluetun and gluetun has the kill switch not qbit. qbit can't access anything without it. Even the local web interface goes through gluetun.


    In looking at some of the documentation around healthcheck. Some of the commands that I see would need to be run on the command line in the container itself. I'd also like to point out the log, qbittorrent was restarted only after gluetun went down and needed to be restarted.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!