Re: Is there is shutdown utility for postgresql?

From: Paul Tomblin <ptomblin(at)xcski(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Is there is shutdown utility for postgresql?
Date: 2002-01-15 23:51:54
Message-ID: 20020115185154.A9215@allhats.xcski.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Quoting Jeff Lu (jklcom(at)mindspring(dot)com):
>
> Is there another to shutdown the database other than "kill" or ctrl-C?

Probably a simple "pg_ctl stop" would do it most of the time, but this is
what it does on RedHat 7.2.

stop(){
# Check for postmaster already running... exit if this happens
pid=`pidof -s postmaster`
if [ "$pid" == "" ]; then
rm -f /var/run/postmaster.pid
rm -f /var/lock/subsys/postgresql
exit 0;
fi
echo -n $"Stopping postgresql service: "
# Check for older PGDATA location.
if [ -f /var/lib/pgsql/PG_VERSION ] && [ -d /var/lib/pgsql/base/template1 ]
then
export PGDATA=/var/lib/pgsql
else
export PGDATA=/var/lib/pgsql/data
fi
su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl stop -D $PGDATA -s -m fast" > /dev/null 2>&1
ret=$? # This will always be 0, as the return code doesn't propagate... Fix that some day.
if [ $ret -eq 0 ]; then
echo_success
else
echo_failure
fi
echo
rm -f /var/run/postmaster.pid
rm -f /var/lock/subsys/postgresql
}

--
Paul Tomblin <ptomblin(at)xcski(dot)com>, not speaking for anybody
Real Time, adj.:
Here and now, as opposed to fake time, which only occurs there
and then.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeffrey W. Baker 2002-01-16 00:00:56 Re: Is there is shutdown utility for postgresql?
Previous Message Dave Trombley 2002-01-15 23:12:52 User defined types and storage variance