[GENERAL] /etc/rc.d/init.d/postgresql... WAS : Rebuilding 6.5.3 RPMs

From: Nicolas Huillard <nhuillard(at)ghs(dot)fr>
To: "'Lamar Owen'" <lamar(dot)owen(at)wgcr(dot)org>, "'pgsql-general(at)postgreSQL(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: [GENERAL] /etc/rc.d/init.d/postgresql... WAS : Rebuilding 6.5.3 RPMs
Date: 2000-02-02 21:51:21
Message-ID: 01BF6DD0.06C433D0@agen.int.ghs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Here is my proposal for the postgresql launch script for RedHat RPMs... Can you criticize it, and maybe modify the RPM SPEC file in order to integrate this automatically (I don't know exactly how to update the SPEC file in order to create all this).

The script uses a pg_params file for additionnal parameters (like -N, -B, -i, etc), and redirects all the output to a log file (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 this file must be created during installation, with the following rights (/var/log belongs to root, so we have to create a subdir 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/move the /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(dot)owen(at)wgcr(dot)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 "-B 512 -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

Browse pgsql-general by date

  From Date Subject
Next Message kaiq 2000-02-03 00:22:53 Re: [GENERAL] apache logs to pgsql
Previous Message Mathew Schwartz 2000-02-02 21:38:35 Postgres