3 # PostgreSQL boot time startup script for FreeBSD. Copy this file to
4 # /usr/local/etc/rc.d/postgresql.
6 # Created through merger of the Linux start script by Ryan Kirkpatrick
7 # and the script in the FreeBSD ports collection.
9 # $PostgreSQL: pgsql/contrib/start-scripts/freebsd,v 1.4 2004/10/01 18:30:21 tgl Exp $
14 prefix=/usr/local/pgsql
17 PGDATA="/usr/local/pgsql/data"
19 # Who to run the postmaster as, usually "postgres". (NOT "root")
22 # Where to keep a log file
23 PGLOG="$PGDATA/serverlog"
27 # The path that is to be used for the script
28 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
30 # What to use to start up the postmaster (we do NOT use pg_ctl for this,
31 # as it adds no value and can cause the postmaster to misrecognize a stale
33 DAEMON="$prefix/bin/postmaster"
35 # What to use to shut down the postmaster
36 PGCTL="$prefix/bin/pg_ctl"
38 # Only start if we can find the postmaster.
39 test -x "$DAEMON" || exit 0
43 su -l $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
47 su -l $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast"
50 su -l $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast -w"
51 su -l $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
54 su -l $PGUSER -c "$PGCTL status -D '$PGDATA'"
58 echo "Usage: `basename $0` {start|stop|restart|status}" 1>&2