Fixing minor issues with bash script
This commit is contained in:
parent
408d2d2cc3
commit
6091b87f96
@ -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}
|
Loading…
Reference in New Issue
Block a user