Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

3 Answers

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
add comment

None.

As per man:

service - run a System V init script

share|improve this answer
add comment

None.
/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
add comment

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.