Skip to content

Commit

Permalink
Merge pull request #37 from WadeBarnes/fix/defunct-processes
Browse files Browse the repository at this point in the history
Fix defunct PostgreSQL processes
  • Loading branch information
WadeBarnes authored Feb 10, 2020
2 parents 9b3b27f + 69c05eb commit 1c66488
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ COPY webhook-template.json /
# - https://blog.danman.eu/cron-jobs-in-openshift/
# --------------------------------------------------------------------------------------------------------
ARG SOURCE_REPO=BCDevOps
ARG GOCROND_VERSION=0.6.2
ARG GOCROND_VERSION=0.6.3
ADD https://github.com/$SOURCE_REPO/go-crond/releases/download/$GOCROND_VERSION/go-crond-64-linux /usr/bin/go-crond

USER root
Expand Down
19 changes: 16 additions & 3 deletions docker/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1061,9 +1061,10 @@ function runBackups(){
function startCron(){
logInfo "Starting backup server in cron mode ..."
listSettings
echoBlue "Starting go-crond as a forground task ...\n"
CRON_CMD="go-crond -v --allow-unprivileged ${BACKUP_CONF}"
exec ${CRON_CMD}
echoBlue "Starting go-crond as a background task ...\n"
CRON_CMD="go-crond -v --default-user=${UID} --allow-unprivileged ${BACKUP_CONF}"
exec ${CRON_CMD} &
wait
}

function startLegacy(){
Expand Down Expand Up @@ -1292,6 +1293,16 @@ function getDbSize(){
return ${rtnCd}
)
}

function shutDown() {
for jobId in $(jobs | awk -F '[][]' '{print $2}' ) ; do
echo "Shutting down background job '${jobId}' ..."
kill %${jobId}
done

echo "Waiting for any background jobs to complete ..."
wait
}
# ======================================================================================

# ======================================================================================
Expand Down Expand Up @@ -1346,6 +1357,8 @@ export DATABASE_SERVER_TIMEOUT=${DATABASE_SERVER_TIMEOUT:-30}
# =================================================================================================================
# Initialization:
# -----------------------------------------------------------------------------------------------------------------
trap shutDown EXIT INT TERM

while getopts clr:v:f:1spha: FLAG; do
case $FLAG in
c)
Expand Down

0 comments on commit 1c66488

Please sign in to comment.