From ce8bdc9b0adeda37c906e45c8ab4e69a61e87b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= Date: Tue, 18 Feb 2025 01:31:25 +0100 Subject: [PATCH] Basic dependency tracking - make sure pdnsmysql is up and running before starting pdns --- lib/functions.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/functions.sh b/lib/functions.sh index 6dc86bf..3760a9d 100644 --- a/lib/functions.sh +++ b/lib/functions.sh @@ -358,10 +358,25 @@ start_service() { SERVICE="$1" COMMAND="$2" RETRY="$3" + local DEPENDS="" # Start /federated/apps/SERVICE with output to /dev/null echo -ne "* Starting $SERVICE.." + if [ -e /federated/services/$SERVICE/service ]; then + . /federated/services/$SERVICE/services + if [ -n "$DEPENDS" ]; then + echo "Ensuring dependencies are up and running" + local dep + for dep in $DEPENDS; do + echo "* ... $dep" + if ! /federated/bin/check $dep; then + /federated/bin/fix $dep + fi + done + fi + fi + if [ $DEBUG ]; then # Start /federated/apps/SERVICE with output to console for debug docker compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE up