66

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
user7044
  • 3,871
  • which service do you wish to start/stop/restart? there is at least a way to do it in several services but I think you should be more specific on your needs. I don't think there is a way to start/stop/restart all the services at the same time. – Geppettvs D'Constanzo Aug 23 '11 at 19:21
  • for example if i wanted to stop nginx,I would do something like this $service nginx stop; I wanted to know if there are any other alternative ways to stop and start a service. Any GUI based application that displays or shows us the unused services etc. – user7044 Aug 23 '11 at 19:33
  • I edited my answer to include a GUI client called BUM. If you're interested in GUIs, you should edit your answer to take out "command." Generally when people are looking for a "command" they aren't interested in a GUI. – Kris Harper Aug 23 '11 at 20:53
  • You may find interesting the answers in this question http://askubuntu.com/questions/19320/whats-the-recommend-way-to-enable-disable-services. – Geppettvs D'Constanzo Aug 23 '11 at 21:02
  • The duplicate is wrong: this is not about enabling/disabling, but starting/stopping. Also, this question has an accepted answer. – Andrea Corbellini Sep 11 '13 at 14:18
  • 1
    @AndreaCorbellini Answers there, including its accepted answer, also include information about how to start and stop services. Furthermore, the topics are naturally very closely related--anyone who wants to enable and disable services will probably want to know how to start and stop them as well, and most people who want to know how to start and stop them will likely also want to know how to enable and disable them. So I'm not sure. – Eliah Kagan Sep 11 '13 at 15:42
  • @EliahKagan: oops, you are right. :) – Andrea Corbellini Sep 11 '13 at 16:26

2 Answers2

58

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>
38

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.

Kris Harper
  • 13,477
  • Boot-up Manager (bum) is very nice to have an easy report of services on our system. – Stefano Nov 15 '11 at 21:56
  • Why is the preferred method to use the binary in init.d/ and not the service manager service as part of the sysvinit-utils package? – ThorSummoner May 12 '15 at 20:24
  • @ThorSummoner it used to be but these days I think upstart is the prefered way. – vidstige Oct 21 '15 at 11:54
  • Update: from Ubuntu 15.104 "Vivid" Canonical dropped upstart and switched to another init system, called systemd, adopted also by Debian and other major distros such as Arch, Fedora, RedHat and SuSe. So, unlike to upstart, seems reasonable to consider that systemd it's here to stay, for quite a long time. – gerlos Mar 14 '18 at 10:33