Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 have seen two ways to start a postgresql server:

/sbin/service postgresql-9.1 start

/etc/init.d/postgresql-9.1 start

Could anyone explain the difference between these two? Or there's no difference at all?

The OS we are using is CentOS 6.2

share|improve this question
up vote 1 down vote accepted

On your system, and most "older" systems, service does the same thing as running the init script. Depending on the implementation, it might set a more predictable environment, so it's still preferred to use it if available.

The general idea, however, is that service will also work with newer init systems. So for example, if you have Upstart, then service will instead of running some script signal the Upstart system to start or stop a service. So to be future-proof, use service.

share|improve this answer


As per man:

service - run a System V init script

share|improve this answer

/sbin/service is just generic script that will run init script and pass the command (you will see if you take a look at /sbin/service)
So basicly now you can say: service name command[start/stop/status/restart/...]

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.