adjusting _seup_supervisor to not restart when wrong log-level given

This commit is contained in:
Georg Lauterbach 2021-02-25 10:57:20 +01:00
parent 0fa5c1ef9d
commit 0d9fb096b7
No known key found for this signature in database
GPG key ID: 2FDC58699AF121C6

View file

@ -14,25 +14,27 @@ function _setup_supervisor
if ! grep -q "loglevel = ${SUPERVISOR_LOGLEVEL}" /etc/supervisor/supervisord.conf if ! grep -q "loglevel = ${SUPERVISOR_LOGLEVEL}" /etc/supervisor/supervisord.conf
then then
case "${SUPERVISOR_LOGLEVEL}" in case "${SUPERVISOR_LOGLEVEL}" in
'critical' | 'error' | 'warn' | 'info' | 'debug' ) 'critical' | 'error' | 'info' | 'debug' )
sed -i -E \ sed -i -E \
"s|loglevel.*|loglevel = ${SUPERVISOR_LOGLEVEL}|g" \ "s|(loglevel).*|\1 = ${SUPERVISOR_LOGLEVEL}|g" \
/etc/supervisor/supervisord.conf /etc/supervisor/supervisord.conf
supervisorctl reload
;;
'warn' )
return 0
;; ;;
* ) * )
_notify 'err' \ _notify 'err' \
"SUPERVISOR_LOGLEVEL value '${SUPERVISOR_LOGLEVEL}' unknown. Defaulting to 'warn'" "SUPERVISOR_LOGLEVEL '${SUPERVISOR_LOGLEVEL}' unknown. Using default 'warn'"
sed -i -E \
's|loglevel.*|loglevel = warn|g' \
/etc/supervisor/supervisord.conf
;; ;;
esac esac
supervisorctl reload
fi fi
return 0
} }
function _setup_default_vars function _setup_default_vars