From 57bc3acafee41e11443f9d742dc84d15c8a47043 Mon Sep 17 00:00:00 2001 From: Jeny Sadadia Date: Wed, 3 Jan 2024 12:32:36 +0530 Subject: [PATCH] restart_services.sh: restart pipeline service when `.env` file changes Environment variable `KCI_API_TOKEN` is required to run pipeline services. The variable is defined in `.env` file. Add a script to monitor `.env` file. If the file changes are detected, that is if the token is modified, restart all the services. Signed-off-by: Jeny Sadadia --- restart_services.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 restart_services.sh diff --git a/restart_services.sh b/restart_services.sh new file mode 100755 index 000000000..12a253a15 --- /dev/null +++ b/restart_services.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +FILE=".env" +inotifywait -m -e close_write $FILE | while read EVENT; +do + echo $EVENT + echo ".env file changes detected. Restarting pipeline services..." + docker-compose down + docker-compose up --build --no-cache +done