Re: PostgreSQL With Slackware

From: Grega Bremec <grega(dot)bremec(at)noviforum(dot)si>
To: Janio Rosa da Silva <janio_2003(at)yahoo(dot)com(dot)br>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: PostgreSQL With Slackware
Date: 2004-06-23 06:53:01
Message-ID: 20040623065301.GA18621@elbereth.noviforum.si
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

...and on Wed, Jun 23, 2004 at 01:38:44AM -0300, Janio Rosa da Silva used the keyboard:
>
> I am looking for a way to start PostgreSQL when the computer is turned
> on. Any ideas?
>
> I am using Slackware 9.1 and PostgreSQL 7.4.2;
>
> I was made a rc.postgresql script file. And I called for it from rc.local.
>
> But, I thing when the slackware is starting, the commands in script file are
> executting under root. But the pg_ctl or postmaster should be executed under
> the postgres user.
>
> Who can I start the postgresql server when the slackware is turned on?
>
> thanks,
>
> Janio

Hello,

We have a couple of setups running PostgreSQL, all based on Slackware,
various versions.

I don't know if you're aware of it, but Slackware init had been a lot more
sysv-like since 8.0 already. The only thing missing are init.d and rc?.d
directories in /etc/rc.d; if you create these and put things inside, the
rc scripts will automatically pick it up and do the right thing [tm]. Well,
almost.

That said, you can use the contrib/start-scripts/linux script to control
PostgreSQL, which will also switch the identity when starting up postmaster,
all you need is to modify it a bit if you installed under a prefix other
than /usr/local/pgsql/.

Two notes though:

- you will need to patch the /etc/rc.d/rc.sysvinit script, as it
currently does kill scripts in a wrong manner - instead of
executing kill scripts for the target runlevel, it executes them
for the originating runlevel, which is wrong. Then again, it's no
biggie, as all you need to change is in the attached patch

- I've done some modifications to contrib/start-scripts/linux that
will also source a file containing environment variables for extra
data directories, so there's no need for manual modifications of
runtime environment to make postmaster realize there are other
locations for databases - all you need is add an environment
variable to that file; the attached script is the modified one,
but do look into ${prefix}, ${PGDATA} and ${PGLOG} - they most
probably don't contain the values you want

Recap - patch /etc/rc.d/rc.sysvinit with the attached patch, create

$ mkdir /etc/rc.d/{init,rc{0,1,2,3,4,5,6}}.d

put the attached postgres script into /etc/rc.d/init.d/ and create
symlinks in appropriate runlevel directories. If you'd like to use
extra data directoeis, put the attached data_dirs file into postgres
home directory. After you've done that, everything should go smoothly
on startup.

(Hopefully the patches go through to the list, if not and anybody is
interested, e-mail me and I'll send them to you too.)

Hope this helped,
--
Grega Bremec
Senior Administrator
Noviforum Ltd., Software & Media
http://www.noviforum.si/

Attachment Content-Type Size
rc.sysvinit.patch text/plain 910 bytes
postgres text/plain 2.6 KB
data_dirs text/plain 686 bytes

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Aryan Ariel Rodriguez Chalas 2004-06-23 07:36:00 Problems with the connection to a Remote Database.
Previous Message Steve Lane 2004-06-23 06:42:52 Re: PostgreSQL With Slackware