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 # contrib/start-scripts/freebsd
14 prefix
=/usr
/local
/pgsql
17 PGDATA
="/usr/local/pgsql/data"
19 # Who to run postgres 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 postgres. (If you want the script to wait
31 # until the server has started, you could use "pg_ctl start" here.)
32 DAEMON
="$prefix/bin/postgres"
34 # What to use to shut down postgres
35 PGCTL
="$prefix/bin/pg_ctl"
37 # Only start if we can find postgres.
40 echo "$DAEMON not found"
46 su
-l $PGUSER -c "$DAEMON -D '$PGDATA' >>$PGLOG 2>&1 &"
50 su
-l $PGUSER -c "$PGCTL stop -D '$PGDATA' -s"
53 su
-l $PGUSER -c "$PGCTL stop -D '$PGDATA' -s"
54 su
-l $PGUSER -c "$DAEMON -D '$PGDATA' >>$PGLOG 2>&1 &"
57 su
-l $PGUSER -c "$PGCTL status -D '$PGDATA'"
61 echo "Usage: `basename $0` {start|stop|restart|status}" 1>&2