Start background writer during archive recovery. Background writer now performs
[PostgreSQL.git] / contrib / start-scripts / freebsd
blob6851b1fcb0057d1bcb84b47688a71c90327e1a97
1 #! /bin/sh
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$
11 ## EDIT FROM HERE
13 # Installation prefix
14 prefix=/usr/local/pgsql
16 # Data directory
17 PGDATA="/usr/local/pgsql/data"
19 # Who to run the postmaster as, usually "postgres". (NOT "root")
20 PGUSER=postgres
22 # Where to keep a log file
23 PGLOG="$PGDATA/serverlog"
25 ## STOP EDITING HERE
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
32 # lock file)
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
41 case $1 in
42 start)
43 su -l $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
44 echo -n ' postgresql'
46 stop)
47 su -l $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast"
49 restart)
50 su -l $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast -w"
51 su -l $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
53 status)
54 su -l $PGUSER -c "$PGCTL status -D '$PGDATA'"
57 # Print help
58 echo "Usage: `basename $0` {start|stop|restart|status}" 1>&2
59 exit 1
61 esac
63 exit 0