Postgresql starup script for second instance?

Posted by Andrius on Super User See other posts from Super User or by Andrius
Published on 2014-06-06T09:22:08Z Indexed on 2014/06/06 9:28 UTC
Read the original article Hit count: 231

Filed under:
|
|
|

I need to run my second postgresql instance when linux boots. I added this command (like in postgresql documentation) in rc.local:

/usr/lib/postgresql/9.1/bin/pg_ctl start -l logfile -D /var/lib/postgresql/9.1/main2

But if I try to run pg_ctl:

cannot be run as root

Please log in (using, e.g., "su") as the (unprivileged) user that will
own the server process.
t, it gives me this error:

How can I specify to run that command as postgres, but actually execute it with root (because root owns it).

Or is there some better way to make second init script for postgresql?

P.S. (I'm using Ubuntu)

© Super User or respective owner

Related posts about ubuntu

Related posts about script