Thread: help in starting up / shutting down postgres as another user

help in starting up / shutting down postgres as another user

From
"Dorward Villaruz"
Date:
is it possible to start postgres from another user, we only know the
postgres account password and our shell account to use.
we have an application that needs to restart postgres if it crashes. ü


Re: help in starting up / shutting down postgres as another user

From
Tom Lane
Date:
"Dorward Villaruz" <dorwardv@ntsp.nec.co.jp> writes:
> we have an application that needs to restart postgres if it crashes. �

Why do you think you need that?

Postmaster crashes (as opposed to crashes of individual backends) are so
rare in my experience that it's not worth worrying about; I'd certainly
not think that an external application having control over the
postmaster would be a net improvement in reliability.

I have seen some sites where the postmaster is spawned as a child of
init, so that if it does happen to die, init will automatically start
a new one.  Might be worth doing if you're paranoid.

            regards, tom lane

Re: help in starting up / shutting down postgres as another

From
Medi Montaseri
Date:
You can use su(1) from a script and setuid(2) from a C program to become
who ever
but not 'root' to launch postgres.

PG needs a database administrator. Most people use postgres. But you can
use anything
you want.

Dorward Villaruz wrote:

>is it possible to start postgres from another user, we only know the
>postgres account password and our shell account to use.
>we have an application that needs to restart postgres if it crashes. ü
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 3: if posting/reading through Usenet, please send an appropriate
>subscribe-nomail command to majordomo@postgresql.org so that your
>message can get through to the mailing list cleanly
>
>




Re: help in starting up / shutting down postgres as another user

From
"Jan Weerts"
Date:

> we have an application that needs to restart postgres if it
>crashes.

This is not a solution, postgres should provide, as it is OS-related.
As Tom already stated, crashes are rare (we never had one in the last years) and if it crashed it obviously cannot control anything else :-)

If crashes are not the main problem, I'd recommend sudo (exists for many unix derivates) or equivalents. It can selectively grant the "other" user the right to execute a postgres startup script/executable as the postgres user, without the need to share passwords or grant more rights than necessary.

HTH
  Jan

Re: help in starting up / shutting down postgres as another

From
"scott.marlowe"
Date:
On Fri, 22 Nov 2002, Jan Weerts wrote:

> > we have an application that needs to restart postgres if it
> >crashes.
>
> This is not a solution, postgres should provide, as it is OS-related.
> As Tom already stated, crashes are rare (we never had one in the last
> years) and if it crashed it obviously cannot control anything else :-)
>
> If crashes are not the main problem, I'd recommend sudo (exists for
> many unix derivates) or equivalents. It can selectively grant the
> "other" user the right to execute a postgres startup script/executable
> as the postgres user, without the need to share passwords or grant
> more rights than necessary.

I just wanna chime in on the "postgres never crashes" thread.

I haven't had postgres crash since I handed 6.5.3 an unconstrained join on
two rather large tables.  And even that took almost an hour before
postgres used up all memory and swap and the linux kernel killed it, so
technically, postgres didn't crash, it just didn't know when to stop
trying to deliver an undeliverable dataset.

Postgres doesn't crash.  Not on good hardware (i.e. error free memory and
CPU).