37 lines
738 B
Bash
37 lines
738 B
Bash
#!/bin/bash
|
|
|
|
. /app/includes.sh
|
|
|
|
# restore
|
|
if [[ "$1" == "restore" ]]; then
|
|
#. /app/restore.sh
|
|
|
|
#shift
|
|
#restore $*
|
|
|
|
echo "not implemented yet"
|
|
exit 0
|
|
fi
|
|
|
|
function configure_cron() {
|
|
local FIND_CRON_COUNT="$(grep -c 'backup.sh' "${CRON_CONFIG_FILE}" 2> /dev/null)"
|
|
if [[ "${FIND_CRON_COUNT}" -eq 0 ]]; then
|
|
echo "${CRON} bash /app/backup.sh" >> "${CRON_CONFIG_FILE}"
|
|
fi
|
|
}
|
|
|
|
init_env
|
|
configure_postgresql
|
|
configure_cron
|
|
|
|
# backup manually
|
|
if [[ "$1" == "backup" ]]; then
|
|
echo "Manually triggering a backup will only execute the backup script once, and the container will exit upon completion."
|
|
|
|
bash "/app/backup.sh"
|
|
|
|
exit 0
|
|
fi
|
|
|
|
# foreground run crond
|
|
exec supercronic -passthrough-logs -quiet "${CRON_CONFIG_FILE}" |