Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I installed PostgreSQL in a pretty standard way on CentOS 5.5:

rpm -ivh http://yum.pgrpms.org/reporpms/9.0/pgdg-centos-9.0-2.noarch.rpm
yum install postgresql90-server postgresql90-contrib
chkconfig postgresql-90 on
/etc/init.d/postgresql-90 initdb

But for some reason I can't use it with the service command because it has no name, .e.g if I do service --status-all I get back the following:

master (pid 3095) is running...
 (pid 3009) is running...
rdisc is stopped

Or even just /etc/init.d/postgresql-90 status:

 (pid 3009) is running...

So how can I give it a name so that I don't have to type out the whole init script path each time?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

The service name is just the name of the script, i.e, postgresql-90.

However, I just installed postgres following your commands above the the init script is actually called postgresql-9.0, not postgresql-90.

$ sudo /sbin/service postgresql-9.0 status
 (pid  16670) is running...

I'm sure you're dying to know why it doesn't tell you the name of the service, aren't you? It's because /etc/rc.d/init.d/postgresql-9.0 doesn't call the function status correctly:

status -p /var/run/postmaster-${PGMAJORVERSION}.${PGPORT}.pid

From /etc/rc.d/init.d/functions:

status() {
        local base pid pid_file=

        # Test syntax.
        if [ "$#" = 0 ] ; then
                echo $"Usage: status [-p pidfile] {program}"
                return 1
        fi
        ...

Thus /etc/rc.d/init.d/postgresql-9.0 should be

status -p /var/run/postmaster-${PGMAJORVERSION}.${PGPORT}.pid $0

and the output is correct:

$ sudo /sbin/service postgresql-9.0 status
postgresql-9.0 (pid  16670) is running...
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.