From 9552a3a2e3fc6656813dfce817dc2cbe0d0b4e1d Mon Sep 17 00:00:00 2001 From: Dan Langille Date: Thu, 8 Aug 2019 17:42:23 -0400 Subject: [PATCH] Add restart support for postgresql When doing a restart, look for and log errors --- cert-puller | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/cert-puller b/cert-puller index a37149e..5aa6a10 100755 --- a/cert-puller +++ b/cert-puller @@ -81,7 +81,7 @@ sudo_examples(){ echo "anvil ALL=(ALL) NOPASSWD:${SERVICE} ${service} graceful" ;; - "dovecot" | "mosquitto" | "nginx" | "postfix") + "dovecot" | "mosquitto" | "nginx" | "postfix" | "postgresql") echo "anvil ALL=(ALL) NOPASSWD:${SERVICE} ${service} restart" ;; esac @@ -174,14 +174,28 @@ restart_services(){ case ${service} in "apache22" | "apache24") ${LOGGER} doing a graceful on ${service} - ${SUDO} ${SERVICE} ${service} graceful + ERRORS=`${SUDO} ${SERVICE} ${service} graceful 2>&1` + if [ $? != 0 ]; then + ${LOGGER} ERROR on restart + ${LOGGER} "${ERRORS}" + echo "${ERRORS}" + else + ${LOGGER} no errors on restart + fi ;; # it might be better if we do a reload. # will that be sufficient? - "dovecot" | "mosquitto" | "nginx" | "postfix") + "dovecot" | "mosquitto" | "nginx" | "postfix" | "postgresql" ) ${LOGGER} restarting ${service} - ${SUDO} ${SERVICE} ${service} restart + ERRORS=`${SUDO} ${SERVICE} ${service} restart 2>&1` + if [ $? != 0 ]; then + ${LOGGER} ERROR on restart + ${LOGGER} "${ERRORS}" + echo "${ERRORS}" + else + ${LOGGER} no errors on restart + fi ;; *)