How to start and stop a service? [duplicate]

Possible Duplicate:
What’s the recommended way to enable / disable services?

Are there any other command to start stop restart service in ubuntu other than the below following.

  1. service --status-all
  2. service <service name> stop
  3. sudosysv-rc-conf

Solution 1:

You can use the following commands:

service <servicename> stop

service <servicename> start

service <servicename> restart

Note service --status-all doesn't stop or start anything, it just returns a status (and there's some known bugs in it).

If you have upstart then you can use these:

stop <servicename>

start <servicename>

restart <servicename>

Solution 2:

It depends largely on the service. The new and preferred way to stop start and restart services is through /etc/init.d. So, for example, to stop or start the Apache Webserver, you can run

/etc/init.d/apache2 stop

/etc/init.d/apache2 start

The same is true of many other services, but probably not all. You can use the utility sysv-rc-conf to see which services you have that use an init.d script and manage them that way as well. Run it with sudo sysv-rc-conf.

If you're looking for a GUI application, try Boot up Manager. Install with

apt-get install bum

and run from the UI or from a terminal with

sudo bum

Usage and documentation can be found here.