Re: Redhat 9.0 Service Shutdown

From: Amir Khawaja <amir(at)gorebels(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Redhat 9.0 Service Shutdown
Date: 2003-12-11 18:47:02
Message-ID: AY2Cb.301$m83.185@fed1read01
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In addition to Beau Bummel post, here is a startup script that I find
very useful:

----- Begin snip -----

#! /bin/sh

# chkconfig: 2345 98 02
# description: PostgreSQL RDBMS

# This is an example of a start/stop script for SysV-style init, such
# as is used on Linux systems. You should edit some of the variables
# and maybe the 'echo' commands.
#
# Place this file at /etc/init.d/postgresql (or
# /etc/rc.d/init.d/postgresql) and make symlinks to
# /etc/rc.d/rc0.d/K02postgresql
# /etc/rc.d/rc1.d/K02postgresql
# /etc/rc.d/rc2.d/K02postgresql
# /etc/rc.d/rc3.d/S98postgresql
# /etc/rc.d/rc4.d/S98postgresql
# /etc/rc.d/rc5.d/S98postgresql
# Or, if you have chkconfig, simply:
# chkconfig --add postgresql
#
# Proper init scripts on Linux systems normally require setting lock
# and pid files under /var/run as well as reacting to network
# settings, so you should treat this with care.

# Original author: Ryan Kirkpatrick <pgsql(at)rkirkpat(dot)net>

# $Header: /cvsroot/pgsql-server/contrib/start-scripts/linux,v 1.3
2001/07/30 14:52:42 momjian Exp $

## EDIT FROM HERE

# Installation prefix
prefix=/usr/local/pgsql

# Data directory
PGDATA="/var/lib/pgsql"

# Who to run pg_ctl as, should be "postgres".
PGUSER=postgres

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

## STOP EDITING HERE

# Check for echo -n vs echo \c
if echo '\c' | grep -s c >/dev/null 2>&1 ; then
ECHO_N="echo -n"
ECHO_C=""
else
ECHO_N="echo"
ECHO_C='\c'
fi

# 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
DAEMON="$prefix/bin/pg_ctl"

set -e

# Only start if we can find pg_ctl.
test -f $DAEMON || exit 0

# Parse command line parameters.
case $1 in
start)
$ECHO_N "Starting PostgreSQL: "$ECHO_C
su - $PGUSER -c "$DAEMON start -D '$PGDATA' -s -l $PGLOG -o \"-i\""
echo "ok"
;;
stop)
echo -n "Stopping PostgreSQL: "
su - $PGUSER -c "$DAEMON stop -D '$PGDATA' -s -m fast"
echo "ok"
;;
restart)
echo -n "Restarting PostgreSQL: "
su - $PGUSER -c "$DAEMON restart -D '$PGDATA' -s -m fast"
echo "ok"
;;
reload)
echo -n "Reloading PostgreSQL configs: "
echo ""
su - $PGUSER -c "PGDATA=$PGDATA $DAEMON reload"
echo "ok"
;;
status)
su - $PGUSER -c "$DAEMON status -D '$PGDATA'"
;;
*)
# Print help
echo "Usage: $0 {start|stop|restart|status}" 1>&2
exit 1
;;
esac

exit 0

----- End snip -----

Best Regards,
Amir Khawaja.

Michael A. Miller wrote:
>
> I start PostgreSQL in the services utility under Redhat 9.0 with no issues.
> PostgreSQL runs properly but as soon as I log out PostgreSQL shuts down. It
> seems that I always need to be logged in for it to stay running.
>
> I am running:
> Redhat 9.0 Kernel 2.4.20-20.9
> PostgreSQL 7.3.4-3.rh19
>
> I am not sure what else could be helpful.
>
> I am fairly new to Linux and PostgreSQL and any pointers would be much
> appreciated.
>
> Regards,
>
> Michael
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
>

--
Amir Khawaja.

----------------------------------
Rules are written for those who lack the ability to truly reason, But
for those who can, the rules become nothing more than guidelines, And
live their lives governed not by rules but by reason.
- James McGuigan

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John Sidney-Woollett 2003-12-11 18:48:36 Re: Schema + search path problem
Previous Message Tom Lane 2003-12-11 18:38:38 Re: Schema + search path problem