|
| 1 | +#! /bin/sh |
| 2 | + |
| 3 | +# PostgreSQL boot time startup script for FreeBSD. Copy this file to |
| 4 | +# /usr/local/etc/rc.d/postgresql. |
| 5 | + |
| 6 | +# Created through merger of the Linux start script by Ryan Kirkpatrick |
| 7 | +# and the script in the FreeBSD ports collection. |
| 8 | + |
| 9 | +# $Header: /cvsroot/pgsql/contrib/start-scripts/freebsd,v 1.1 2001/02/10 00:13:23 petere Exp $ |
| 10 | + |
| 11 | +## EDIT FROM HERE |
| 12 | + |
| 13 | +# Installation prefix |
| 14 | +prefix=/usr/local/pgsql |
| 15 | + |
| 16 | +# Data directory |
| 17 | +PGDATA="/usr/local/pgsql/data" |
| 18 | + |
| 19 | +# Who to run pg_ctl as, should be "postgres". |
| 20 | +PGUSER=postgres |
| 21 | + |
| 22 | +# Where to keep a log file |
| 23 | +PGLOG="$PGDATA/serverlog" |
| 24 | + |
| 25 | +## STOP EDITING HERE |
| 26 | + |
| 27 | +export PGDATA |
| 28 | + |
| 29 | +# The path that is to be used for the script |
| 30 | +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin |
| 31 | + |
| 32 | +# What to use to start up the postmaster |
| 33 | +DAEMON="$prefix/bin/pg_ctl" |
| 34 | + |
| 35 | +test -x"$DAEMON"||exit 0 |
| 36 | + |
| 37 | +case$1in |
| 38 | + start) |
| 39 | + su -l$PGUSER -c"$DAEMON start -s -l$PGLOG" |
| 40 | +echo -n' postgresql' |
| 41 | +;; |
| 42 | + stop) |
| 43 | +su -l$PGUSER -c"$DAEMON stop -s -m fast" |
| 44 | +;; |
| 45 | + restart) |
| 46 | +su -l$PGUSER -c"$DAEMON restart -s -m fast" |
| 47 | +;; |
| 48 | + status) |
| 49 | +su -l$PGUSER -c"$DAEMON status" |
| 50 | +;; |
| 51 | +*) |
| 52 | +# Print help |
| 53 | +echo"Usage:`basename$0` {start|stop|restart|status}"1>&2 |
| 54 | +exit 1 |
| 55 | +;; |
| 56 | +esac |
| 57 | + |
| 58 | +exit 0 |