[GENERAL] /etc/rc.d/init.d/postgresql... WAS : Rebuilding 6.5.3 RPMs - Mailing list pgsql-general

From Nicolas Huillard
Subject [GENERAL] /etc/rc.d/init.d/postgresql... WAS : Rebuilding 6.5.3 RPMs
Date
Msg-id 01BF6DD0.06C433D0@agen.int.ghs
Whole thread Raw
List pgsql-general
Here is my proposal for the postgresql launch script for RedHat RPMs... Can you criticize it, and maybe modify the RPM
SPECfile in order to integrate this automatically (I don't know exactly how to update the SPEC file in order to create
allthis). 


The script uses a pg_params file for additionnal parameters (like -N, -B, -i, etc), and redirects all the output to a
logfile (stdout only, because stderr is very verbose, and outputs on the tty, I dont know why) 
*******************************
diff /etc/rc.d/init.d/postgresql.yours /etc/rc.d/init.d/postgresql.mine
70c70,71
                su -l postgres -c '/usr/bin/postmaster -i -S -D/var/lib/pgsql'
---
                params=$(grep -v -e "^#" -e "^ *$" pg_params 2>&- | paste -s)
                su -l postgres -c "/usr/bin/postmaster ${params} -D/var/lib/pgsql 2>&- >/var/log/postgres/postgres &"
*******************************

The /var/lib/pgsql/pg_params contains the following : one can modify it and restart the service, without editing the
script.
*******************************
# This file contains additional parameters for the postmaster command line
# Comments and empty lines are ignored, and all lines are wrapped in a single line

-i
# -S
-B 512
-N 256
*******************************

The output of the postmaster command, and its postgres children, is directed to a log file. The directory containing
thisfile must be created during installation, with the following rights (/var/log belongs to root, so we have to create
asubdir for user postgres to write to) : 
*******************************
drwxr-xr-x   2 postgres root         1024 Jan 30 04:02 /var/log/postgres/
*******************************

We can then create a /etc/logrotate.d/postgres file, which will rotate and erase old log files. This implies a regular
(weekly,here) restart of the postgres server. 
*******************************
/var/log/postgres/postgres {
    compress
    rotate 2
    weekly
    postrotate
        /etc/rc.d/init.d/postgresql restart
    endscript
}
*******************************

If one doesn't want logging, the few things to do is uncomment the "-S" line in /var/lib/pgsql/pg_params, and
destroy/movethe /etc/logrotate.d/postgres file. 

That's my little contribution to the Postgres project, using my experience of many 6.5.3 servers (developpemnt, tests,
production),with few adjustements between each ones. 

Nicolas Huillard


-----Message d'origine-----
De:    Lamar Owen [SMTP:lamar.owen@wgcr.org]
Date:    mercredi 2 février 2000 20:26
À:    Nicolas Huillard
Objet:    Re: [GENERAL] Rebuilding 6.5.3 RPMs

Nicolas Huillard wrote:
>
> Thank you for posting this to the list.
> I'm not used to finish the informational job against the list.
> BTW : where is the /etc/rc.d/init.d/postgresql file stored in the RPM source/build tree ? (I would like to add some
"-B512 -N 256" stuff to it) 

/usr/src/redhat/SOURCES/postgresql.init.x.x.x, where x.x.x is the
version -- currently 6.5.3.

If you come across modifications that would be of benefit to all RPM
distribution users, pass it my way --- I might just incorporate it into
the official release.

--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11

pgsql-general by date:

Previous
From: "Mathew Schwartz"
Date:
Subject: Postgres
Next
From:
Date:
Subject: Re: [GENERAL] apache logs to pgsql