Commit cb711ef5 authored by Christoph Berg's avatar Christoph Berg

pg_virtualenv: On error, show tail of server log file.

parent 9ff28321
postgresql-common (146) UNRELEASED; urgency=low
* pg_virtualenv: On error, show tail of server log file.
-- Christoph Berg <myon@debian.org> Mon, 17 Jun 2013 13:51:20 +0200
postgresql-common (145) unstable; urgency=low
[ Christoph Berg ]
......
......@@ -77,6 +77,7 @@ if [ "${NONROOT:-}" ]; then
PGSYSCONFDIR="$WORKDIR/postgresql-common" # no export yet so pg_createcluster uses the original createcluster.conf
mkdir "$PGSYSCONFDIR" "$WORKDIR/log"
PWFILE="$PGSYSCONFDIR/pwfile"
LOGDIR="$WORKDIR/log"
cleanup () {
set +e
......@@ -182,11 +183,17 @@ case $PG_VERSIONS in
esac
# run program
if [ "${run_shell:-}" ]; then
"$@" || {
"$@" || EXIT="$?"
if [ ${EXIT:-0} -gt 0 ]; then
for log in ${LOGDIR:-/var/log/postgresql}/*.log; do
echo "$log:"
tail -100 $log
done
if [ "${run_shell:-}" ]; then
echo "pg_virtualenv: command exited with status $?, dropping you into a shell"
$SHELL
}
else
"$@"
fi
fi
exit ${EXIT:-0}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment