Title: Openai/69236e64-afe0-8013-9002-2bf25d4615fd - freem URL Source: https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Openai%2F69236e64-afe0-8013-9002-2bf25d4615fd Markdown Content: _This conversation was exported from ChatGPT_[[1]](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Openai%2F69236e64-afe0-8013-9002-2bf25d4615fd#cite_note-1) ## gpt-5-1[edit](https://freemwiki.com/index.php?title=Openai/69236e64-afe0-8013-9002-2bf25d4615fd&action=edit§ion=1 "Edit section: gpt-5-1") ### User: Restart container when another is rebooted/upgraded[edit](https://freemwiki.com/index.php?title=Openai/69236e64-afe0-8013-9002-2bf25d4615fd&action=edit§ion=2 "Edit section: User: Restart container when another is rebooted/upgraded") Restart container when another is rebooted/upgraded Hi Can anyone tell me how to automatically have a container restart when another go down I have qbitorrent and Qbit-guard, issue is whenever qbit is rebooted the guard goes down and i dont always realise its offline and i would like to automate it is possible ### Assistant: You’ve got a couple clean ways to solve this depending on where you’re running the containers Docker, Docker Compose, P…[edit](https://freemwiki.com/index.php?title=Openai/69236e64-afe0-8013-9002-2bf25d4615fd&action=edit§ion=3 "Edit section: Assistant: You’ve got a couple clean ways to solve this depending on where you’re running the containers Docker, Docker Compose, P…") You’ve got a couple clean ways to solve this depending on where you’re running the containers (Docker, Docker Compose, Portainer, Unraid, Proxmox LXC running Docker inside, etc.). I’ll walk you through the practical options so you can pick what fits. ### ✅ If you’re using Docker Compose[edit](https://freemwiki.com/index.php?title=Openai/69236e64-afe0-8013-9002-2bf25d4615fd&action=edit§ion=4 "Edit section: ✅ If you’re using Docker Compose") This is the best solution because Docker already supports dependency ordering. Add this to qbit-guard: depends_on: qbittorrent: condition: service_healthy …AND make sure qbittorrent has a healthcheck: services: qbittorrent: image: linuxserver/qbittorrent healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080"] interval: 30s timeout: 5s retries: 5 Then: qbit-guard: depends_on: qbittorrent: condition: service_healthy restart: always Effect: * If qbittorrent restarts → qbit-guard automatically gets restarted once qbit is up and healthy. ### ✅ If you’re using plain Docker (no compose)[edit](https://freemwiki.com/index.php?title=Openai/69236e64-afe0-8013-9002-2bf25d4615fd&action=edit§ion=5 "Edit section: ✅ If you’re using plain Docker (no compose)") You need a watchdog container or a small script. Easiest option: ##### Script approach:[edit](https://freemwiki.com/index.php?title=Openai/69236e64-afe0-8013-9002-2bf25d4615fd&action=edit§ion=6 "Edit section: Script approach:") #!/bin/bash while true; do if [ "$(docker inspect -f '{{.State.Status}}' qbittorrent)" != "running" ]; then docker restart qbit-guard fi sleep 10 done Run it as a small systemd service or container. ### ✅ If you’re running on Unraid[edit](https://freemwiki.com/index.php?title=Openai/69236e64-afe0-8013-9002-2bf25d4615fd&action=edit§ion=7 "Edit section: ✅ If you’re running on Unraid") Unraid can do this: 1. Go to Docker tab 2. Click on qbit-guard 3. Set "Wait for other containers" (if using Docker Compose plugin, see above) Or install CA User Scripts plugin: Script: if [ "$(docker inspect -f '{{.State.Status}}' qbittorrent)" = "running" ]; then exit 0 else docker restart qbit-guard fi Schedule: run every 5 minutes. ### ⚠️ If you’re running LXC containers directly in Proxmox[edit](https://freemwiki.com/index.php?title=Openai/69236e64-afe0-8013-9002-2bf25d4615fd&action=edit§ion=8 "Edit section: ⚠️ If you’re running LXC containers directly in Proxmox") Then you’re not using Docker at all. In that case you need: ##### Option A: Use a hookscript[edit](https://freemwiki.com/index.php?title=Openai/69236e64-afe0-8013-9002-2bf25d4615fd&action=edit§ion=9 "Edit section: Option A: Use a hookscript") Proxmox supports hooks that run on container start/stop. Example /root/restart-guard.pm: #!/usr/bin/perl use strict; use warnings; my $vmid = shift; my $phase = shift; if ($vmid == 101 && $phase eq 'post-stop') { system("pct restart 102"); } * 101 = qbittorrent LXC * 102 = qbit-guard LXC Then assign the hookscript: pct set 101 -hookscript /root/restart-guard.pm ##### Option B: Don’t run them as LXCs — run them both inside a single Docker host[edit](https://freemwiki.com/index.php?title=Openai/69236e64-afe0-8013-9002-2bf25d4615fd&action=edit§ion=10 "Edit section: Option B: Don’t run them as LXCs — run them both inside a single Docker host") Honestly this is the cleaner long-term path. ### 👉 Tell me what environment you’re actually running this on (Docker? Docker Compose? Unraid? Proxmox LXCs?) and I’ll give you the exact config.[edit](https://freemwiki.com/index.php?title=Openai/69236e64-afe0-8013-9002-2bf25d4615fd&action=edit§ion=11 "Edit section: 👉 Tell me what environment you’re actually running this on (Docker? Docker Compose? Unraid? Proxmox LXCs?) and I’ll give you the exact config.") I can generate the exact compose file, systemd service, or Proxmox hook for your setup. ## References[edit](https://freemwiki.com/index.php?title=Openai/69236e64-afe0-8013-9002-2bf25d4615fd&action=edit§ion=12 "Edit section: References") 1. [↑](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Openai%2F69236e64-afe0-8013-9002-2bf25d4615fd#cite_ref-1)["Container restart automation"](https://chatgpt.com/share/69236e64-afe0-8013-9002-2bf25d4615fd). ChatGPT. Retrieved 2025-11-24.