head	1.7;
access;
symbols
	REL9_0_0:1.7
	REL9_1_ALPHA1:1.7
	REL9_0_RC1:1.7
	REL9_0_BETA4:1.7
	REL9_0_STABLE:1.7.0.4
	REL9_0_BETA3:1.7
	REL9_0_BETA2:1.7
	REL7_4_29:1.2
	REL8_0_25:1.4
	REL8_1_21:1.4
	REL8_2_17:1.4
	REL8_3_11:1.4
	REL8_4_4:1.4
	REL9_0_BETA1:1.7
	REL9_0_ALPHA5_BRANCH:1.7.0.2
	REL9_0_ALPHA5:1.7
	REL7_4_28:1.2
	REL8_0_24:1.4
	REL8_1_20:1.4
	REL8_2_16:1.4
	REL8_3_10:1.4
	REL8_4_3:1.4
	REL9_0_ALPHA4:1.5
	REL9_0_ALPHA4_BRANCH:1.5.0.6
	REL8_5_ALPHA3:1.5
	REL8_5_ALPHA3_BRANCH:1.5.0.4
	REL7_4_27:1.2
	REL8_0_23:1.4
	REL8_1_19:1.4
	REL8_2_15:1.4
	REL8_3_9:1.4
	REL8_4_2:1.4
	REL8_5_ALPHA2:1.5
	REL8_5_ALPHA2_BRANCH:1.5.0.2
	REL7_4_26:1.2
	REL8_0_22:1.4
	REL8_1_18:1.4
	REL8_2_14:1.4
	REL8_3_8:1.4
	REL8_4_1:1.4
	REL8_5_ALPHA1:1.4
	REL8_5_ALPHA1_BRANCH:1.4.0.14
	REL8_4_STABLE:1.4.0.12
	REL8_4_0:1.4
	REL8_4_RC2:1.4
	REL8_4_RC1:1.4
	REL8_4_BETA2:1.4
	REL8_4_BETA1:1.4
	REL7_4_25:1.2
	REL8_0_21:1.4
	REL8_1_17:1.4
	REL8_2_13:1.4
	REL8_3_7:1.4
	REL7_4_24:1.2
	REL8_0_20:1.4
	REL8_1_16:1.4
	REL8_2_12:1.4
	REL8_3_6:1.4
	REL7_4_23:1.2
	REL8_0_19:1.4
	REL8_1_15:1.4
	REL8_2_11:1.4
	REL8_3_5:1.4
	REL7_4_22:1.2
	REL8_0_18:1.4
	REL8_1_14:1.4
	REL8_2_10:1.4
	REL8_3_4:1.4
	REL7_4_21:1.2
	REL8_0_17:1.4
	REL8_1_13:1.4
	REL8_2_9:1.4
	REL8_3_3:1.4
	REL7_4_20:1.2
	REL8_0_16:1.4
	REL8_1_12:1.4
	REL8_2_8:1.4
	REL8_3_2:1.4
	REL8_2_7:1.4
	REL8_3_1:1.4
	REL8_3_STABLE:1.4.0.10
	REL8_3_0:1.4
	REL8_3_RC2:1.4
	REL7_3_21:1.2
	REL7_4_19:1.2
	REL8_0_15:1.4
	REL8_1_11:1.4
	REL8_2_6:1.4
	REL8_3_RC1:1.4
	REL8_3_BETA4:1.4
	REL8_3_BETA3:1.4
	REL8_3_BETA2:1.4
	REL8_3_BETA1:1.4
	REL7_3_20:1.2
	REL7_4_18:1.2
	REL8_0_14:1.4
	REL8_1_10:1.4
	REL8_2_5:1.4
	REL7_3_19:1.2
	REL7_4_17:1.2
	REL8_0_13:1.4
	REL8_1_9:1.4
	REL8_2_4:1.4
	REL8_0_12:1.4
	REL8_1_8:1.4
	REL8_2_3:1.4
	REL7_3_18:1.2
	REL7_4_16:1.2
	REL8_0_11:1.4
	REL8_1_7:1.4
	REL8_2_2:1.4
	REL8_0_10:1.4
	REL8_1_6:1.4
	REL8_2_1:1.4
	REL7_4_15:1.2
	REL7_3_17:1.2
	REL8_2_STABLE:1.4.0.8
	REL8_2_0:1.4
	REL8_2_RC1:1.4
	REL8_2_BETA3:1.4
	REL8_2_BETA2:1.4
	REL8_1_5:1.4
	REL8_0_9:1.4
	REL7_4_14:1.2
	REL7_3_16:1.2
	REL8_2_BETA1:1.4
	REL7_3_15:1.2
	REL7_4_13:1.2
	REL8_0_8:1.4
	REL8_1_4:1.4
	REL7_3_14:1.2
	REL7_4_12:1.2
	REL8_0_7:1.4
	REL8_1_3:1.4
	REL7_3_13:1.2
	REL7_4_11:1.2
	REL8_0_6:1.4
	REL8_1_2:1.4
	REL7_3_12:1.2
	REL7_4_10:1.2
	REL8_0_5:1.4
	REL8_1_1:1.4
	REL8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1.2.0.2
	REL7_1:1.1;
locks; strict;
comment	@# @;


1.7
date	2010.02.23.22.17.25;	author momjian;	state Exp;
branches;
next	1.6;

1.6
date	2010.02.23.22.15.35;	author momjian;	state Exp;
branches;
next	1.5;

1.5
date	2009.08.27.16.59.38;	author tgl;	state Exp;
branches;
next	1.4;

1.4
date	2004.10.01.18.30.21;	author tgl;	state Exp;
branches;
next	1.3;

1.3
date	2003.11.29.19.51.35;	author pgsql;	state Exp;
branches;
next	1.2;

1.2
date	2001.04.19.19.17.44;	author petere;	state Exp;
branches;
next	1.1;

1.1
date	2001.02.10.00.13.23;	author petere;	state Exp;
branches;
next	;


desc
@@


1.7
log
@Modify freebsd start script to just exit 0 with message.
@
text
@#! /bin/sh

# PostgreSQL boot time startup script for FreeBSD.  Copy this file to
# /usr/local/etc/rc.d/postgresql.

# Created through merger of the Linux start script by Ryan Kirkpatrick
# and the script in the FreeBSD ports collection.

# $PostgreSQL: pgsql/contrib/start-scripts/freebsd,v 1.6 2010/02/23 22:15:35 momjian Exp $

## EDIT FROM HERE

# Installation prefix
prefix=/usr/local/pgsql

# Data directory
PGDATA="/usr/local/pgsql/data"

# Who to run the postmaster as, usually "postgres".  (NOT "root")
PGUSER=postgres

# Where to keep a log file
PGLOG="$PGDATA/serverlog"

## STOP EDITING HERE

# The path that is to be used for the script
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# What to use to start up the postmaster.  (If you want the script to wait
# until the server has started, you could use "pg_ctl start -w" here.
# But without -w, pg_ctl adds no value.)
DAEMON="$prefix/bin/postmaster"

# What to use to shut down the postmaster
PGCTL="$prefix/bin/pg_ctl"

# Only start if we can find the postmaster.
test -x $DAEMON ||
{
	echo "$DAEMON not found"
	exit 0
}

case $1 in
    start)
	su -l $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
	echo -n ' postgresql'
	;;
    stop)
	su -l $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast"
	;;
    restart)
	su -l $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast -w"
	su -l $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
	;;
    status)
	su -l $PGUSER -c "$PGCTL status -D '$PGDATA'"
	;;
    *)
	# Print help
	echo "Usage: `basename $0` {start|stop|restart|status}" 1>&2
	exit 1
	;;
esac

exit 0
@


1.6
log
@Update startup scripts for Linux and FreeBSD.

Kevin Grittner
@
text
@d9 1
a9 1
# $PostgreSQL: pgsql/contrib/start-scripts/freebsd,v 1.5 2009/08/27 16:59:38 tgl Exp $
d42 1
a42 4
	if [ "$1" = "stop" ]
	then exit 0
	else exit 5
	fi
@


1.5
log
@Make it reasonably safe to use pg_ctl to start the postmaster from a boot-time
script.

To do this, have pg_ctl pass down its parent shell's PID in an environment
variable PG_GRANDPARENT_PID, and teach CreateLockFile() to disregard that PID
as a false match if it finds it in postmaster.pid.  This allows us to cope
with one level of postgres-owned shell process even with pg_ctl in the way,
so it's just as safe as starting the postmaster directly.  You still have to
be careful about how you write the initscript though.

Adjust the comments in contrib/start-scripts/ to not deprecate use of
pg_ctl.  Also, fix the ROTATELOGS option in the OSX script, which was
indulging in exactly the sort of unsafe coding that renders this fix
pointless :-(.  A pipe inside the "sudo" will probably result in more
than one postgres-owned process hanging around.
@
text
@d9 1
a9 1
# $PostgreSQL: pgsql/contrib/start-scripts/freebsd,v 1.4 2004/10/01 18:30:21 tgl Exp $
d39 8
a46 1
test -x "$DAEMON" || exit 0
@


1.4
log
@Adjust postmaster to recognize that a lockfile containing its parent's PID
must be stale.  Tweak example startup scripts to not use pg_ctl but launch
the postmaster directly, thereby ensuring that only the postmaster's direct
parent shell will be a postgres-owned process.  In combination these should
fix the longstanding problem of the postmaster sometimes refusing to start
during reboot because it thinks the old lockfile is not stale.
@
text
@d9 1
a9 1
# $PostgreSQL: pgsql-server/contrib/start-scripts/freebsd,v 1.3 2003/11/29 19:51:35 pgsql Exp $
d30 3
a32 3
# What to use to start up the postmaster (we do NOT use pg_ctl for this,
# as it adds no value and can cause the postmaster to misrecognize a stale
# lock file)
@


1.3
log
@
$Header: -> $PostgreSQL Changes ...
@
text
@d9 1
a9 1
# $PostgreSQL: /cvsroot/pgsql-server/contrib/start-scripts/freebsd,v 1.2 2001/04/19 19:17:44 petere Exp $
d19 1
a19 1
# Who to run pg_ctl as, should be "postgres".
d30 4
a33 2
# What to use to start up the postmaster
DAEMON="$prefix/bin/pg_ctl"
d35 4
d43 1
a43 1
        su -l $PGUSER -c "$DAEMON start -D '$PGDATA' -s -l $PGLOG"
d47 1
a47 1
	su -l $PGUSER -c "$DAEMON stop -D '$PGDATA' -s -m fast"
d50 2
a51 1
	su -l $PGUSER -c "$DAEMON restart -D '$PGDATA' -s -m fast"
d54 1
a54 1
	su -l $PGUSER -c "$DAEMON status -D '$PGDATA'"
@


1.2
log
@Pass -D option to pg_ctl because export PGDATA won't be preserved across
'su -l'.

Reported by <VASQUEZ_JASON@@LILLY.COM>.
@
text
@d9 1
a9 1
# $Header: /home/projects/pgsql/cvsroot/pgsql/contrib/start-scripts/freebsd,v 1.1 2001/02/10 00:13:23 petere Exp $
@


1.1
log
@Add new FreeBSD start script that makes use of new pg_ctl functionality.
@
text
@d9 1
a9 1
# $Header$
a26 2
export PGDATA

d37 1
a37 1
        su -l $PGUSER -c "$DAEMON start -s -l $PGLOG"
d41 1
a41 1
	su -l $PGUSER -c "$DAEMON stop -s -m fast"
d44 1
a44 1
	su -l $PGUSER -c "$DAEMON restart -s -m fast"
d47 1
a47 1
	su -l $PGUSER -c "$DAEMON status"
@
