File:  [Repository] / StartupItems / PostgreSQL / PostgreSQL
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Thu Jun 8 17:50:02 2006 UTC (17 years, 11 months ago) by casties
Branches: vendor, MAIN
CVS tags: release, HEAD
First version of StartupItems

#!/bin/sh

. /etc/rc.common

##
# Start up the PostgreSQL database server on Mac OS X / Darwin
#
#
# History
# -------
#
# 2002-08-21  Marc Liyanage <liyanage@access.ch>
#             Changed startup to use pg_ctl
#
# 2002-08-19  Ed Silva <ed@septicus.com>
#             Modified startup script to conform
#             to new SystemStarter format for Mac OS X 10.2
#
# 2001-04-02  Marc Liyanage <liyanage@access.ch>
#             First version
#
# 2001-12-02  Johan Henselmans <johanhenselmans@mac.com>
#             Enhanced after carefully studying the Frontbase
#             startup sequence ;-)
#             Now provides a stop procedure for a graceful shutdown
#             and a hard kill if the clean shutdown doesn't work.
#
# 2001-12-02  Marc Liyanage <liyanage@access.ch>
#             Added localized startup messages in 7 languages
#             by adapting the resources of the Apple-supplied
#             "Sendmail" startup script.
#
#
# License
# -------
#
# The PostgreSQL BSD-style license applies to this file
#

PGDIR=/Volumes/paviaExtern/pgsql
DATADIR=/Volumes/paviaExtern/pgsql/data
PGUSER=admin

StartService ()
{

	if [ "${POSTGRES:=-YES-}" = "-YES-" ]; then

	    ConsoleMessage "Starting PostgreSQL database server"
#	    su postgres -c '/usr/local/pgsql8.1.3/bin/pg_ctl start -D /usr/local/pgsql8.1.3/data -l /usr/local/pgsql8.1.3/logfile -o -i'
	    su $PGUSER -c "$PGDIR/bin/pg_ctl start -D $DATADIR -o -i"

	fi

}

StopService()
{

	ConsoleMessage "Stopping PostgreSQL database services"
	su $PGUSER -c "$PGDIR/bin/pg_ctl stop -D $DATADIR"
	#$PGDIR/bin/pg_ctl stop -D $DATADIR
	x=`/bin/ps axc | /usr/bin/grep postgres`
	if /bin/test "$x"
	then
		set $x
		kill -9 $x
	fi

}

RestartService ()
{
    StopService
    StartService
}


RunService "$1"

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>