4 # PotgreSQL RDBMS Server
7 # PostgreSQL boot time startup script for Darwin/Mac OS X. To install, change
8 # the "prefix", "PGDATA", "PGUSER", and "PGLOG" variables below as
9 # necessary. Next, create a new directory, "/Library/StartupItems/PostgreSQL".
10 # Then copy this script and the accompanying "StartupParameters.plist" file
11 # into that directory. The name of this script file *must* be the same as the
12 # directory it is in. So you'll end up with these two files:
14 # /Library/StartupItems/PostgreSQL/PostgreSQL
15 # /Library/StartupItems/PostgreSQLStartupParameters.plist
17 # Next, add this line to the /etc/hostconfig file:
19 # POSTGRESQLSERVER=-YES-
21 # The startup bundle will now be ready to go. To prevent this script from
22 # starting PostgreSQL at system startup, simply change that line in
23 # /etc/hostconfig back to:
25 # POSTGRESQLSERVER=-NO-
27 # For more information on Darwin/Mac OS X startup bundles, see this article:
29 # http://www.opensource.apple.com/projects/documentation/howto/html/SystemStarter_HOWTO.html
31 # Created by David Wheeler, 2002.
33 ################################################################################
35 ################################################################################
38 prefix=/usr/local/pgsql
41 PGDATA="/usr/local/pgsql/data"
43 # Who to run pg_ctl as, should be "postgres".
46 # Where to keep a log file
47 PGLOG="$PGDATA/serverlog"
49 ################################################################################
51 ################################################################################
53 # The path that is to be used for the script
54 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
56 # What to use to start up the postmaster
57 DAEMON="$prefix/bin/pg_ctl"
62 if [ "${POSTGRESQLSERVER:=-NO-}" = "-YES-" ]; then
63 ConsoleMessage "Starting PostgreSQL database server"
64 sudo -u $PGUSER $DAEMON start -D "$PGDATA" -s -l $PGLOG
69 ConsoleMessage "Stopping PostgreSQL database server"
70 sudo -u $PGUSER $DAEMON stop -D "$PGDATA" -s -m fast
74 if [ "${POSTGRESQLSERVER:=-NO-}" = "-YES-" ]; then
75 ConsoleMessage "Restarting PostgreSQL database server"
76 sudo -u $PGUSER $DAEMON restart -D "$PGDATA" -s -m fast