<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://freemwiki.com/index.php?action=history&amp;feed=atom&amp;title=Openai%2F69236e64-afe0-8013-9002-2bf25d4615fd</id>
	<title>Openai/69236e64-afe0-8013-9002-2bf25d4615fd - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://freemwiki.com/index.php?action=history&amp;feed=atom&amp;title=Openai%2F69236e64-afe0-8013-9002-2bf25d4615fd"/>
	<link rel="alternate" type="text/html" href="https://freemwiki.com/index.php?title=Openai/69236e64-afe0-8013-9002-2bf25d4615fd&amp;action=history"/>
	<updated>2026-05-05T08:30:40Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.3</generator>
	<entry>
		<id>https://freemwiki.com/index.php?title=Openai/69236e64-afe0-8013-9002-2bf25d4615fd&amp;diff=593609&amp;oldid=prev</id>
		<title>Lukegao: by freem.ai...</title>
		<link rel="alternate" type="text/html" href="https://freemwiki.com/index.php?title=Openai/69236e64-afe0-8013-9002-2bf25d4615fd&amp;diff=593609&amp;oldid=prev"/>
		<updated>2025-11-24T06:34:09Z</updated>

		<summary type="html">&lt;p&gt;by freem.ai...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
{{DISPLAYTITLE:Container restart automation}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;This conversation was exported from ChatGPT&amp;#039;&amp;#039;&amp;lt;ref&amp;gt;{{cite web|title=Container restart automation|url=https://chatgpt.com/share/69236e64-afe0-8013-9002-2bf25d4615fd|publisher=ChatGPT|access-date=2025-11-24}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== gpt-5-1 ==&lt;br /&gt;
=== User: Restart container when another is rebooted/upgraded ===&lt;br /&gt;
Restart container when another is rebooted/upgraded&lt;br /&gt;
&lt;br /&gt;
Hi &lt;br /&gt;
&lt;br /&gt;
Can anyone tell me how to automatically have a container restart when another go down &lt;br /&gt;
&lt;br /&gt;
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&lt;br /&gt;
&lt;br /&gt;
=== Assistant: You’ve got a couple clean ways to solve this depending on where you’re running the containers Docker, Docker Compose, P… ===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== ✅ If you’re using Docker Compose ===&lt;br /&gt;
&lt;br /&gt;
This is the best solution because Docker already supports dependency ordering.&lt;br /&gt;
&lt;br /&gt;
Add this to qbit-guard:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;yaml&amp;quot;&amp;gt;depends_on:&lt;br /&gt;
  qbittorrent:&lt;br /&gt;
    condition: service_healthy&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
…AND make sure qbittorrent has a healthcheck:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;yaml&amp;quot;&amp;gt;services:&lt;br /&gt;
  qbittorrent:&lt;br /&gt;
    image: linuxserver/qbittorrent&lt;br /&gt;
    healthcheck:&lt;br /&gt;
      test: [&amp;quot;CMD&amp;quot;, &amp;quot;curl&amp;quot;, &amp;quot;-f&amp;quot;, &amp;quot;http://localhost:8080&amp;quot;]&lt;br /&gt;
      interval: 30s&lt;br /&gt;
      timeout: 5s&lt;br /&gt;
      retries: 5&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;yaml&amp;quot;&amp;gt;qbit-guard:&lt;br /&gt;
  depends_on:&lt;br /&gt;
    qbittorrent:&lt;br /&gt;
      condition: service_healthy&lt;br /&gt;
  restart: always&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Effect:&lt;br /&gt;
* If qbittorrent restarts → qbit-guard automatically gets restarted once qbit is up and healthy.&lt;br /&gt;
&lt;br /&gt;
=== ✅ If you’re using plain Docker (no compose) ===&lt;br /&gt;
&lt;br /&gt;
You need a watchdog container or a small script. Easiest option:&lt;br /&gt;
&lt;br /&gt;
===== Script approach: =====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
while true; do&lt;br /&gt;
    if [ &amp;quot;$(docker inspect -f &amp;#039;{{.State.Status}}&amp;#039; qbittorrent)&amp;quot; != &amp;quot;running&amp;quot; ]; then&lt;br /&gt;
        docker restart qbit-guard&lt;br /&gt;
    fi&lt;br /&gt;
    sleep 10&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run it as a small systemd service or container.&lt;br /&gt;
&lt;br /&gt;
=== ✅ If you’re running on Unraid ===&lt;br /&gt;
&lt;br /&gt;
Unraid can do this:&lt;br /&gt;
# Go to Docker tab&lt;br /&gt;
# Click on qbit-guard&lt;br /&gt;
# Set &amp;quot;Wait for other containers&amp;quot; (if using Docker Compose plugin, see above)&lt;br /&gt;
&lt;br /&gt;
Or install CA User Scripts plugin:&lt;br /&gt;
&lt;br /&gt;
Script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;if [ &amp;quot;$(docker inspect -f &amp;#039;{{.State.Status}}&amp;#039; qbittorrent)&amp;quot; = &amp;quot;running&amp;quot; ]; then&lt;br /&gt;
    exit 0&lt;br /&gt;
else&lt;br /&gt;
    docker restart qbit-guard&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Schedule: run every 5 minutes.&lt;br /&gt;
&lt;br /&gt;
=== ⚠️ If you’re running LXC containers directly in Proxmox ===&lt;br /&gt;
&lt;br /&gt;
Then you’re not using Docker at all.&lt;br /&gt;
&lt;br /&gt;
In that case you need:&lt;br /&gt;
&lt;br /&gt;
===== Option A: Use a hookscript =====&lt;br /&gt;
&lt;br /&gt;
Proxmox supports hooks that run on container start/stop.&lt;br /&gt;
&lt;br /&gt;
Example /root/restart-guard.pm:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;perl&amp;quot;&amp;gt;#!/usr/bin/perl&lt;br /&gt;
&lt;br /&gt;
use strict;&lt;br /&gt;
use warnings;&lt;br /&gt;
&lt;br /&gt;
my $vmid = shift;&lt;br /&gt;
my $phase = shift;&lt;br /&gt;
&lt;br /&gt;
if ($vmid == 101 &amp;amp;&amp;amp; $phase eq &amp;#039;post-stop&amp;#039;) {&lt;br /&gt;
    system(&amp;quot;pct restart 102&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* 101 = qbittorrent LXC&lt;br /&gt;
* 102 = qbit-guard LXC&lt;br /&gt;
&lt;br /&gt;
Then assign the hookscript:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;pct set 101 -hookscript /root/restart-guard.pm&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Option B: Don’t run them as LXCs — run them both inside a single Docker host =====&lt;br /&gt;
&lt;br /&gt;
Honestly this is the cleaner long-term path.&lt;br /&gt;
&lt;br /&gt;
=== 👉 Tell me what environment you’re actually running this on (Docker? Docker Compose? Unraid? Proxmox LXCs?) and I’ll give you the exact config. ===&lt;br /&gt;
&lt;br /&gt;
I can generate the exact compose file, systemd service, or Proxmox hook for your setup.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:ChatGPT Shares]]&lt;br /&gt;
[[Category:openai]]&lt;/div&gt;</summary>
		<author><name>Lukegao</name></author>
	</entry>
</feed>