stop.sh and start.sh previously relied on ambient COMPOSE_FILE, so backup fencing left orchestration unable to stop or restart the target node. Pass -f base.yml and the node yml explicitly and fail loudly. Co-authored-by: Cursor <cursoragent@cursor.com>
20 lines
548 B
Bash
Executable File
20 lines
548 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ -z "$1" ] || [ ! -f "/root/rpc/$1.yml" ]; then
|
|
echo "Error: Either no argument provided or /root/rpc/$1.yml does not exist."
|
|
exit 1
|
|
fi
|
|
|
|
services=$(cat "/root/rpc/$1.yml" | yaml2json - | jq '.services' | jq -r 'keys[]' | tr '\n' ' ')
|
|
if [ -z "$services" ]; then
|
|
echo "FATAL: no services found in /root/rpc/$1.yml" >&2
|
|
exit 1
|
|
fi
|
|
|
|
docker compose -f /root/rpc/base.yml -f "/root/rpc/$1.yml" stop $services
|
|
rc=$?
|
|
if [ $rc -ne 0 ]; then
|
|
echo "FATAL: docker compose stop failed for $1 (exit $rc)" >&2
|
|
exit $rc
|
|
fi
|