Re: Redhat 9.0 Service Shutdown - Mailing list pgsql-general

From Brummel, Beau
Subject Re: Redhat 9.0 Service Shutdown
Date
Msg-id 4D0D18BB953A224CB5ADD13E5FE64BF21A6EAC@hly_ad03.marketron.com
Whole thread Raw
In response to Redhat 9.0 Service Shutdown  ("Michael A. Miller" <Michael.Miller@cedillas.com>)
List pgsql-general
Hi Michael,

I am new too. The following has worked for me, though it is quite crude.

#1. I created a small script to start and stop PostgreSQL
    in /etc/init.d. It is named simply "postgres" and the
    code is as follows:
    ---------------------------
    case "$1" in
        start) su - postgres -c "nohup /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data -i > logfile &>2 &";;
        stop) PID=`head -1 /usr/local/pgsql/data/postmaster.pid | cut -b1-4`; kill -15 $PID;;
    esac
    ---------------------------
    The start line starts postgresql with nohup in the background, so it does not care
    if anyone particular is logged int or not. The stop line just gets the pid for
    postmaster and sends it a TERM signal, though it doesn't look that simple.

    As a newbie, I was having issues using pg_ctl in startup because it needs parameters
    so I made this as a workaround. New to Linux? Make sure
    you execute "chmod a+x postgres" on this file after you create it.

#2. I wanted postgresql to start in run levels 2, 3, and 5 (single user, multiuser, XWindows)
    so I created links in the appropriate /etc/rc.d/rc#.d folders (rc2.d, rc3.d, rc5.d).
    After cd'ing into each folder, I executed the following:

    for starting postgresql:       ln -s /etc/init.d/postgres S92postgres
      for stopping postgresql:       ln -s /etc/init.d/postgres K02postgres

    This needs to be done in each directory - /etc/rc.d/rc2.d, /etc/rc.d/rc3.d, /etc/rc.d/rc5.d
    Run level 4 is not used at present, so no need to do it in rc4.d, though no harm either, I
    suppose. No biggy if you need to change the numeric portion the links, for example,
    if you already have a K02*, just use K03 or something else that is available.

Red Hat had a much slicker startup/shutdown script than mine, but I did
not install Postgres on my last install of Linux, instead installing
Postgres 7.4 from the postgresql web site, so I had to make my own stuff.

Also, I use this exclusively for startup and shutdown - I use pg_ctl for
interactive management of PostgreSQL as its much richer than my script.

Thanks,

Beau


-----Original Message-----
From: Michael A. Miller [mailto:Michael.Miller@cedillas.com]
Sent: Wednesday, December 10, 2003 7:11 PM
To: PostgreSQL (General)
Subject: [GENERAL] Redhat 9.0 Service Shutdown




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


pgsql-general by date:

Previous
From: "Jeff Cave"
Date:
Subject: Re: Any commercial shopping cart packages using postgresql?
Next
From: Jan Wieck
Date:
Subject: Re: add column sillyness