From 433f9798987ae20b68c32984e1ff5cdc94635ed9 Mon Sep 17 00:00:00 2001 From: Martin Kleinschrodt Date: Wed, 15 Dec 2021 12:57:49 +0100 Subject: [PATCH] Only attempt to start amplify agent if amplify key is set --- nginx/entrypoint.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/nginx/entrypoint.sh b/nginx/entrypoint.sh index 2b5afa8e..216c41aa 100644 --- a/nginx/entrypoint.sh +++ b/nginx/entrypoint.sh @@ -60,16 +60,17 @@ if [ -n "${api_key}" -o -n "${amplify_imagename}" ]; then chown nginx ${nginx_status_conf} > /dev/null 2>&1 fi -if ! grep '^api_key.*=[ ]*[[:alnum:]].*' ${agent_conf_file} > /dev/null 2>&1; then - echo "no api_key found in ${agent_conf_file}! exiting." -fi +if ! grep '^api_key.*=[ ]*[[:alnum:]].*' ${agent_conf_file} > /dev/null 2>&1; +then + echo "no api_key found in ${agent_conf_file}! Skipping amplify agent." +else + echo "starting amplify-agent ..." + service amplify-agent start > /dev/null 2>&1 < /dev/null -echo "starting amplify-agent ..." -service amplify-agent start > /dev/null 2>&1 < /dev/null - -if [ $? != 0 ]; then - echo "couldn't start the agent, please check ${agent_log_file}" - exit 1 + if [ $? != 0 ]; then + echo "couldn't start the agent, please check ${agent_log_file}" + exit 1 + fi fi wait ${nginx_pid}