Update README and rotate script to clarify container restart order and improve handling of additional restart containers
Build and Push Docker Images / build-and-push (push) Successful in 39s

This commit is contained in:
2026-06-05 18:22:04 +02:00
parent 34ee842d34
commit 86360ec066
2 changed files with 26 additions and 12 deletions
@@ -41,14 +41,10 @@ pick_random_region() {
printf '%s\n' "${regions[@]}" | shuf -n 1
}
parse_restart_containers() {
# CSV: "m3u-filter-vpn,m3u-editor,xtream-proxy" or JSON array.
# Falls back to GLUETUN_CONTAINER when unset.
parse_additional_restart_containers() {
# Sidecars to restart after gluetun. CSV or JSON array.
local raw="${RESTART_CONTAINERS:-}"
if [[ -z "$raw" ]]; then
echo "${GLUETUN_CONTAINER:-m3u-filter-vpn}"
return
fi
[[ -z "$raw" ]] && return 0
if [[ "$raw" =~ ^\[.*\]$ ]]; then
jq -r '.[]' <<<"$raw"
@@ -58,6 +54,23 @@ parse_restart_containers() {
tr ',' '\n' <<<"$raw" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | awk 'NF'
}
parse_restart_containers() {
# Gluetun is always restarted first, then any RESTART_CONTAINERS (deduplicated).
local gluetun="${GLUETUN_CONTAINER:-m3u-filter-vpn}"
local -A seen=()
local container
echo "$gluetun"
seen["$gluetun"]=1
while IFS= read -r container; do
[[ -z "$container" ]] && continue
[[ -n "${seen[$container]+x}" ]] && continue
echo "$container"
seen["$container"]=1
done < <(parse_additional_restart_containers)
}
restart_containers() {
local container restarted=()
while IFS= read -r container; do