I am currently installing PostgreSQL from source on a RHEL6 system. I have generally been following the official documentation for guidance (http://www.postgresql.org/docs/9.4/static/installation.html).
Unfortunately, there isn't too much information by way of of the init.d/startup scripts. Here's what I'm currently struggling with:
- the OOB start-up script (https://github.com/postgres/postgres/blob/master/contrib/start-scripts/linux) is copied to /etc/init.d/postgres with slight modifications to reflect my environment (e.g. prefix, data path, etc); file is owned by root and has 755 permissions
- the following commands are executed as root to ensure execution on boot: chkconfig --add postgresql; chkconfig postgresql on;
- as root, the script runs without issues (e.g. /etc/init.d/postgresql status)
- however, the script returns with a password prompt when it is executed as the postgres user (the user that is configured to run PostgreSQL)
This experience is vastly different from how the packaged version (i.e. RPM) of PostgreSQL functions. I am able to execute the script as root and as postgres:
[root@ulvjived80 ~]# /etc/init.d/postgresql-9.4 status postgresql-9.4 is stopped [postgres@ulvjived80 ~]$ /etc/init.d/postgresql-9.4 status postgresql-9.4 is stopped
I've done quite a bit of searching online and the most cited solution I've found relates to permitting the command/script for the relevant user in the /etc/sudoers file. However, the RPM doesn't seem to do that.
A commercial application that we use also behaves in the same way i.e. the startup script can be executed by root and by the relevant non-root user.
Are there any ideas as to how I can mimic the RPMs functionality?