[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: postgresql startup script



Unfortunately, no, it doesn't. It comes with pg_ctl, which is as far as I
can tell just a wrapper around postmaster.  Since sending the message,
I've solved the problem thusly, and it seems to work:

(contents of /etc/init.d/postgresql :)

#! /bin/sh
#
# To stop postgresql running, do
#   ln -sf /bin/false /usr/lib/postgresql/bin/can_i_run
# To re-enable it, do
#   rm /usr/lib/postgresql/bin/can_i_run

case "$1" in
    start)
	echo Starting PostgreSQL postmaster
	start-stop-daemon --chuid postgres --exec /usr/local/pgsql/bin/postmaster --start /usr/local/pgsql/bin/postmaster -- -D/var/lib/postgres/data -i -S
        ;;
    stop)
	echo Stopping PostgreSQL postmaster
	start-stop-daemon --exec /usr/local/pgsql/bin/postmaster --stop
        ;;
    restart)
	echo Restarting PostgreSQL postmaster
	start-stop-daemon --exec /usr/local/pgsql/bin/postmaster --stop
	start-stop-daemon --chuid postgres --exec /usr/local/pgsql/bin/postmaster --start /usr/local/pgsql/bin/postmaster -- -D/var/lib/postgres/data -i -S
	;;
    force-reload)
	echo Reload not supported by PostgreSQL - restarting postmaster
	start-stop-daemon --exec /usr/local/pgsql/bin/postmaster --stop
	start-stop-daemon --chuid postgres --exec /usr/local/pgsql/bin/postmaster --start /usr/local/pgsql/bin/postmaster -- -D/var/lib/postgres/data -i -S
	;;
    reload)
	echo PostgreSQL does not support a reload option
	exit 2
	;;
    *)
        echo "Usage: /etc/init.d/postgresql {start|stop|restart}"
        exit 1
	;;
esac

exit 0


----------------------------------------------------------------------
Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology  
Chapel Hill, North Carolina, USA - http://demog.berkeley.edu/~aperrin
        aperrin@socrates.berkeley.edu - aperrin@igc.apc.org
On Sun, 25 Feb 2001, Aaron Brashears wrote:

> Does the source distribution come with the file bin/postresql-startup
> in the PGHOME directory?  In the debian distribution, this script is
> called by /etc/init.d/postgresql and handles startup based on the
> configuration file.
> 
> On Sun, Feb 25, 2001 at 08:52:02PM -0500, Andrew Perrin wrote:
> > Could some kind soul help out with this? I built postgres from source
> > instead of using the .deb, and all works fine except for having it start
> > on bootup.  I'm stuck on trying to get the startup script to run as user
> > 'postgres' instead of as root.  I tried to have it issue the command:
> > 
> > su postgres '/usr/local/pgsql/bin/pg_ctl -w -D/var/lib/postgres/data -o
> > "-i" start'
> > 
> 



Reply to: