From 6091b87f968354cfac8ee82935e632280a2c823a Mon Sep 17 00:00:00 2001 From: Paulino Padial Date: Tue, 23 Jan 2018 18:58:37 +0100 Subject: [PATCH] Fixing minor issues with bash script --- docker-entrypoint.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index fe235ab..5833c7f 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Logic for Password file required # If PASSWORD_SECRET env var is defined, search for the /run/secrets/${PASSWORD_SECRET} and read the content @@ -29,22 +29,25 @@ fi if [ "${CRON_SCHEDULE}" ]; then echo "Configuring a CUSTOM SCHEDULE in /etc/crontab for ${CRON_SCHEDULE} ..." # Create the crontab file - cat <<-EOF > /etc/crontab +cat <<-EOF > /etc/crontab + SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command -${CRON_SCHEDULE} /usr/sbin/autopostgresqlbackup -EOF - # the file should have the correct content +${CRON_SCHEDULE} /usr/sbin/autopostgresqlbackup +EOF +else + echo "Using cron.daily schedule..." fi # Create the file echo "Creating the password file..." cat <<-EOF > ${HOME}/.pgpass -${DBHOST}:*:*:${USERNAME:-postgres}:${PASSPHRASE} + +${DBHOST:-localhost}:*:*:${USERNAME:-postgres}:${PASSPHRASE} EOF # Execute cron with parameters (autopostgresql script is under /etc/cron.daily) echo "Execute cron service..." -exec cron -f -l ${CRON_LOG_LEVEL:-8} +exec cron -f -l ${CRON_LOG_LEVEL:-8} \ No newline at end of file