Only attempt to start amplify agent if amplify key is set

This commit is contained in:
Martin Kleinschrodt 2021-12-15 12:57:49 +01:00
parent 730920e861
commit 433f979898
1 changed files with 10 additions and 9 deletions

View File

@ -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}