fix: db-tool: NO_TTY
This commit is contained in:
@@ -4,7 +4,13 @@ postgres_cleanup_main() {
|
||||
if [ -z "${PG_WORKING_DIR:-}" ] && [ -z "${LOCAL_DIR:-}" ]; then return 0; fi
|
||||
: "${PG_WORKING_DIR:=$LOCAL_DIR/focus/postgresql}"
|
||||
if [ -f "${PG_WORKING_DIR}/data/postmaster.pid" ]; then
|
||||
pg_ctl -D "${PG_WORKING_DIR}/data" -m fast -w stop || :
|
||||
if [ "${NO_TTY:-0}" = "1" ]; then
|
||||
_pg_log="$(mktemp /tmp/postgres-cleanup.XXXXXX.log)"
|
||||
pg_ctl -D "${PG_WORKING_DIR}/data" -m fast -w stop > "$_pg_log" 2>&1 || :
|
||||
printf '%s\n' "postgres-cleanup: pg_ctl stop output redirected to $_pg_log" >&2
|
||||
else
|
||||
pg_ctl -D "${PG_WORKING_DIR}/data" -m fast -w stop || :
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user