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)