Thread: Starting postmaster in rc.local

Starting postmaster in rc.local

From
"Chris Boget"
Date:
On the following page

http://www.postgresql.org/idocs/index.php?installation.html

It says that I need to su to the user postgres to start postmaster.
In fact, when I try to start it as user root, it won't let me and that
is somewhat understandable.  But ideally, I'd like it so that user
postgres does not have a shell (which is what I've done for the
mysql user I had to set up).
When I tried to set up the command to start up postgres in the
rc.local to run as user postgres, I'm having problems.  I know there
has got to be a way for me to be able to do this but I'm still too
new to *nix to know how.  I've looked throughout the PgSQL docs,
mimiced the line I have for mysql (but making the relevant changes),
did some searches on the web but have come up blank.
Could someone point me to where I need to look to discover how
to do what I want?

thnx,
Chris


Re: Starting postmaster in rc.local

From
"Chris Boget"
Date:
Got a very delayed bounce having sent this so I'm trying again
and hope it makes it through...

On the following page

http://www.postgresql.org/idocs/index.php?installation.html

It says that I need to su to the user postgres to start postmaster.
In fact, when I try to start it as user root, it won't let me and that
is somewhat understandable.  But ideally, I'd like it so that user
postgres does not have a shell (which is what I've done for the
mysql user I had to set up).
When I tried to set up the command to start up postgres in the
rc.local to run as user postgres, I'm having problems.  I know there
has got to be a way for me to be able to do this but I'm still too
new to *nix to know how.  I've looked throughout the PgSQL docs,
mimiced the line I have for mysql (but making the relevant changes),
did some searches on the web but have come up blank.
Could someone point me to where I need to look to discover how
to do what I want?

thnx,
Chris


Re: Starting postmaster in rc.local

From
Peter & Sarah Childs
Date:
On Monday 02 December 2002 14:31, Chris Boget wrote:
> On the following page
>
> http://www.postgresql.org/idocs/index.php?installation.html
>
> It says that I need to su to the user postgres to start postmaster.
> In fact, when I try to start it as user root, it won't let me and that
> is somewhat understandable.  But ideally, I'd like it so that user
> postgres does not have a shell (which is what I've done for the
> mysql user I had to set up).
> When I tried to set up the command to start up postgres in the
> rc.local to run as user postgres, I'm having problems.  I know there
> has got to be a way for me to be able to do this but I'm still too
> new to *nix to know how.  I've looked throughout the PgSQL docs,
> mimiced the line I have for mysql (but making the relevant changes),
> did some searches on the web but have come up blank.
> Could someone point me to where I need to look to discover how
> to do what I want?
>
> thnx,
> Chris
>

    I think this is best done the same way as the redhat init script does it
hence

su -l postgres -s /bin/sh -c "/usr/local/pgsql/bin/pg_ctl  -D $PGD
ATA -p /usr/local/pgsql/bin/postmaster start  > /dev/null 2>&1" < /dev/null

    Doing a "man su" should tell you about any other flags you want. but

-l -  a login shell
<user> - the user name.
-s <shell name> - use this shell
-c <command name> - run this command
< /dev/null - take input from /dev/null (nowhere!)


    I hope that helps

Peter Childs