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 (18 years, 1 month ago) by casties
Branches: vendor, MAIN
CVS tags: release, HEAD
First version of StartupItems

    1: #!/bin/sh
    2: 
    3: . /etc/rc.common
    4: 
    5: ##
    6: # Start up the PostgreSQL database server on Mac OS X / Darwin
    7: #
    8: #
    9: # History
   10: # -------
   11: #
   12: # 2002-08-21  Marc Liyanage <liyanage@access.ch>
   13: #             Changed startup to use pg_ctl
   14: #
   15: # 2002-08-19  Ed Silva <ed@septicus.com>
   16: #             Modified startup script to conform
   17: #             to new SystemStarter format for Mac OS X 10.2
   18: #
   19: # 2001-04-02  Marc Liyanage <liyanage@access.ch>
   20: #             First version
   21: #
   22: # 2001-12-02  Johan Henselmans <johanhenselmans@mac.com>
   23: #             Enhanced after carefully studying the Frontbase
   24: #             startup sequence ;-)
   25: #             Now provides a stop procedure for a graceful shutdown
   26: #             and a hard kill if the clean shutdown doesn't work.
   27: #
   28: # 2001-12-02  Marc Liyanage <liyanage@access.ch>
   29: #             Added localized startup messages in 7 languages
   30: #             by adapting the resources of the Apple-supplied
   31: #             "Sendmail" startup script.
   32: #
   33: #
   34: # License
   35: # -------
   36: #
   37: # The PostgreSQL BSD-style license applies to this file
   38: #
   39: 
   40: PGDIR=/Volumes/paviaExtern/pgsql
   41: DATADIR=/Volumes/paviaExtern/pgsql/data
   42: PGUSER=admin
   43: 
   44: StartService ()
   45: {
   46: 
   47: 	if [ "${POSTGRES:=-YES-}" = "-YES-" ]; then
   48: 
   49: 	    ConsoleMessage "Starting PostgreSQL database server"
   50: #	    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'
   51: 	    su $PGUSER -c "$PGDIR/bin/pg_ctl start -D $DATADIR -o -i"
   52: 
   53: 	fi
   54: 
   55: }
   56: 
   57: StopService()
   58: {
   59: 
   60: 	ConsoleMessage "Stopping PostgreSQL database services"
   61: 	su $PGUSER -c "$PGDIR/bin/pg_ctl stop -D $DATADIR"
   62: 	#$PGDIR/bin/pg_ctl stop -D $DATADIR
   63: 	x=`/bin/ps axc | /usr/bin/grep postgres`
   64: 	if /bin/test "$x"
   65: 	then
   66: 		set $x
   67: 		kill -9 $x
   68: 	fi
   69: 
   70: }
   71: 
   72: RestartService ()
   73: {
   74:     StopService
   75:     StartService
   76: }
   77: 
   78: 
   79: RunService "$1"

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