Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

rpm -ivh
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
up vote 3 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

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


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.