How to enable or disable services?












779















I read about how to enable and disable services in Ubuntu and it seems that there are different possibilities to manage them.



The first method I found is update-rc.d to add new services to startup, which aims on the /etc/init.d folder and its contents.



The other one I found is to edit .conf files in the /etc/init folder.



What's the recommended way to enable / disable / add services and why?



Could you please give a short bulletproof step by step example on how to add a service in Ubuntu and enable and disable it?










share|improve this question




















  • 1





    For networking please see: askubuntu.com/questions/230698/…

    – Jorge Castro
    Nov 13 '13 at 18:19











  • This would be helpful for those stuck on Fedora 12 and have landed here. In case linkrot chkconfig is what you are looking for.

    – Bleeding Fingers
    Feb 27 '14 at 10:49






  • 3





    Note that the answer for Ubuntu 14.04 is still missing here.

    – Reinier Post
    Dec 3 '15 at 13:43






  • 2





    @MarcelloNuccio: Starting with Ubuntu 15.04, Upstart has been deprecated in favor of Systemd.

    – Dan Dascalescu
    Sep 10 '16 at 3:35
















779















I read about how to enable and disable services in Ubuntu and it seems that there are different possibilities to manage them.



The first method I found is update-rc.d to add new services to startup, which aims on the /etc/init.d folder and its contents.



The other one I found is to edit .conf files in the /etc/init folder.



What's the recommended way to enable / disable / add services and why?



Could you please give a short bulletproof step by step example on how to add a service in Ubuntu and enable and disable it?










share|improve this question




















  • 1





    For networking please see: askubuntu.com/questions/230698/…

    – Jorge Castro
    Nov 13 '13 at 18:19











  • This would be helpful for those stuck on Fedora 12 and have landed here. In case linkrot chkconfig is what you are looking for.

    – Bleeding Fingers
    Feb 27 '14 at 10:49






  • 3





    Note that the answer for Ubuntu 14.04 is still missing here.

    – Reinier Post
    Dec 3 '15 at 13:43






  • 2





    @MarcelloNuccio: Starting with Ubuntu 15.04, Upstart has been deprecated in favor of Systemd.

    – Dan Dascalescu
    Sep 10 '16 at 3:35














779












779








779


498






I read about how to enable and disable services in Ubuntu and it seems that there are different possibilities to manage them.



The first method I found is update-rc.d to add new services to startup, which aims on the /etc/init.d folder and its contents.



The other one I found is to edit .conf files in the /etc/init folder.



What's the recommended way to enable / disable / add services and why?



Could you please give a short bulletproof step by step example on how to add a service in Ubuntu and enable and disable it?










share|improve this question
















I read about how to enable and disable services in Ubuntu and it seems that there are different possibilities to manage them.



The first method I found is update-rc.d to add new services to startup, which aims on the /etc/init.d folder and its contents.



The other one I found is to edit .conf files in the /etc/init folder.



What's the recommended way to enable / disable / add services and why?



Could you please give a short bulletproof step by step example on how to add a service in Ubuntu and enable and disable it?







upstart services






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 20 '14 at 14:54









Seth

34.3k26110162




34.3k26110162










asked Dec 29 '10 at 21:03









NESNES

14k3490113




14k3490113








  • 1





    For networking please see: askubuntu.com/questions/230698/…

    – Jorge Castro
    Nov 13 '13 at 18:19











  • This would be helpful for those stuck on Fedora 12 and have landed here. In case linkrot chkconfig is what you are looking for.

    – Bleeding Fingers
    Feb 27 '14 at 10:49






  • 3





    Note that the answer for Ubuntu 14.04 is still missing here.

    – Reinier Post
    Dec 3 '15 at 13:43






  • 2





    @MarcelloNuccio: Starting with Ubuntu 15.04, Upstart has been deprecated in favor of Systemd.

    – Dan Dascalescu
    Sep 10 '16 at 3:35














  • 1





    For networking please see: askubuntu.com/questions/230698/…

    – Jorge Castro
    Nov 13 '13 at 18:19











  • This would be helpful for those stuck on Fedora 12 and have landed here. In case linkrot chkconfig is what you are looking for.

    – Bleeding Fingers
    Feb 27 '14 at 10:49






  • 3





    Note that the answer for Ubuntu 14.04 is still missing here.

    – Reinier Post
    Dec 3 '15 at 13:43






  • 2





    @MarcelloNuccio: Starting with Ubuntu 15.04, Upstart has been deprecated in favor of Systemd.

    – Dan Dascalescu
    Sep 10 '16 at 3:35








1




1





For networking please see: askubuntu.com/questions/230698/…

– Jorge Castro
Nov 13 '13 at 18:19





For networking please see: askubuntu.com/questions/230698/…

– Jorge Castro
Nov 13 '13 at 18:19













This would be helpful for those stuck on Fedora 12 and have landed here. In case linkrot chkconfig is what you are looking for.

– Bleeding Fingers
Feb 27 '14 at 10:49





This would be helpful for those stuck on Fedora 12 and have landed here. In case linkrot chkconfig is what you are looking for.

– Bleeding Fingers
Feb 27 '14 at 10:49




3




3





Note that the answer for Ubuntu 14.04 is still missing here.

– Reinier Post
Dec 3 '15 at 13:43





Note that the answer for Ubuntu 14.04 is still missing here.

– Reinier Post
Dec 3 '15 at 13:43




2




2





@MarcelloNuccio: Starting with Ubuntu 15.04, Upstart has been deprecated in favor of Systemd.

– Dan Dascalescu
Sep 10 '16 at 3:35





@MarcelloNuccio: Starting with Ubuntu 15.04, Upstart has been deprecated in favor of Systemd.

– Dan Dascalescu
Sep 10 '16 at 3:35










8 Answers
8






active

oldest

votes


















778














There are services that can be enabled/disabled using the GUI (like the startup application) or the terminal.



For the Terminal you have several options. First, open a terminal (Type "terminal" in the dash, for example, and open it). Then:



Temporary enabling/disabling services



To stop and start services temporarily (Does not enable / disable them for future boots), you can type service SERVICE_NAME. For example:




  • sudo service apache2 stop (Will STOP the Apache service until Reboot or until you start it again).


  • sudo service apache2 start (Will START the Apache service assuming it was stopped before.).


  • service apache2 status (Will tell you the STATUS of the service, if it is either enabled/running of disabled/NOT running.).


  • sudo service apache2 restart (Will RESTART the service. This is most commonly used when you have changed, a config file. In this case, if you changed either a PHP configuration or an Apache configuration. Restart will save you from having to stop/start with 2 command lines)


  • service apache2 (In this case, since you did not mention the ACTION to execute for the service, it will show you all options available for that specific service.) This aspect varies depending on the service, for example, with MySQL it would only mention that it is missing a parameter. For other services like networking service it would mention the small list of all options available.





SYSTEMD



Starting with Ubuntu 15.04, Upstart will be deprecated in favor of Systemd. With Systemd to manage the services we can do the following:



systemctl start SERVICE - Use it to start a service. Does not persist after reboot



systemctl stop SERVICE - Use it to stop a service. Does not persist after reboot



systemctl restart SERVICE - Use it to restart a service



systemctl reload SERVICE - If the service supports it, it will reload the config files related to it without interrupting any process that is using the service.



systemctl status SERVICE - Shows the status of a service. Tells whether a service is currently running.



systemctl enable SERVICE - Turns the service on, on the next reboot or on the next start event. It persists after reboot.



systemctl disable SERVICE - Turns the service off on the next reboot or on the next stop event. It persists after reboot.



systemctl is-enabled SERVICE - Check if a service is currently configured to start or not on the next reboot.



systemctl is-active SERVICE - Check if a service is currently active.



systemctl show SERVICE - Show all the information about the service.



sudo systemctl mask SERVICE - Completely disable a service by linking it to /dev/null; you cannot start the service manually or enable the service.



sudo systemctl unmask SERVICE - Removes the link to /dev/null and restores the ability to enable and or manually start the service.





UPSTART (Deprecated Since 15.04)



If we want to use the official Upstart way (Note that, for the moment, not all services have been converted to Upstart), we could use the following commands:



status SERVICE - This will tell us if a converted service is running or not. Note that this is deprecated in favor of start, stop, status & restart. It will also tell us if a service has not yet been converted to upstart:



A converted service would typically output the current status (Starting, Running, Stopping...) and process ID. A non converted service would give an error about an unknown job.



Some shortcuts may only work with the service command above but not with the commands below unless they are 100% converted to upstart services:




  • START - sudo start mysql


  • STOP - sudo stop mysql


  • RESTART - sudo restart mysql


  • STATUS - sudo status smbd



Enabling / Disabling a service



To toggle a service from starting or stopping permanently you would need to:



echo manual | sudo tee /etc/init/SERVICE.override


where the stanza manual will stop Upstart from automatically loading the service on next boot. Any service with the .override ending will take precedence over the original service file. You will only be able to start the service manually afterwards. If you do not want this then simply delete the .override.
For example:



echo manual | sudo tee /etc/init/mysql.override


Will put the MySQL service into manual mode. If you do not want this, afterwards you can simply do



sudo rm /etc/init/mysql.override


and Reboot for the service to start automatically again. Of course to enable a service, the most common way is by installing it. If you install Apache, Nginx, MySQL or others, they automatically start upon finishing installation and will start every time the computer boots. Disabling, as mentioned above, will make use of the service manual.






share|improve this answer


























  • Do you need to add .service to every command? systemctl mongod status worked just fine.

    – Dan Dascalescu
    Sep 10 '16 at 3:36











  • @DanDascalescu no you don't but let me clarify that there.

    – Luis Alvarado
    Sep 10 '16 at 22:19






  • 4





    Should the .override file need to be placed in /etc/init.d/, i.e., where the service is placed?

    – Obi Wan - PallavJha
    Dec 9 '16 at 10:13











  • Why Upstart is deprecated in 15.04 ? what is the right way to run scripts on start/restart in ubuntu 16.04 or later ?

    – Kamalakannan J
    Jan 6 '17 at 20:18






  • 1





    Thanks for this comprehensive answer. The systemd set of commands works a treat on Ubuntu 18.04.

    – Doktor J
    Sep 24 '18 at 14:23



















340





+150









Currently there are actually three different ways for software to be started as a service in Ubuntu, SysV, Upstart and systemd. A service is defined here as a program run by the system in the background, as opposed to one started and run directly by the user.



SysV



The traditional way to start services in Linux was to place a script in /etc/init.d, and then use the update-rc.d command (or in RedHat based distros, chkconfig) to enable or disable it.



This command uses some mildly complicated logic to create symlinks in /etc/rc#.d, that control the order of starting services. If you run ls /etc/rc2.d you can see the order that services will be killed with a file name like K##xxxx and started with file names S##xxxx. The ## in S##xxxx means a "start order" for service xxxx. Conversely, the ## in K##xxxx means the kill order for service xxxx.



One major issue with SysV was that when booting the system, everything had to be done in serial, one thing after another, making system boot times really slow. Attempts were made to parallelize this, but they were haphazard and hard to take full advantage of. This was the main reason that Upstart was created.



Upstart



Upstart uses job definition files in /etc/init to define on what events a service should be started. So, while the system is booting, upstart processes various events, and then can start multiple services in parallel. This allows them to fully utilize the resources of the system, for instance, by starting a disk-bound service up while another CPU-bound service runs, or while the network is waiting for a dynamic IP address to be assigned.



You can see all of the upstart job files by running ls /etc/init/*.conf



Let me just stop here and say that if you don't know what a service is, or what it does, DO NOT disable it!



Not all services have been converted to upstart. While working on the server team at Canonical for the past few months, I've worked on a number of converted job files, and the nicest part is that it allows one to get rid of all the script "magic" and just put in a few commands here and there to define exactly how to start the service, and nothing more. But for now, only a handful of traditional network services, like squid and samba, have been converted.



Is a service upstart-based?



In order to figure out if a service is upstart-based, you can run the status command:



status servicename


If it's an upstart job, it will show this:



$ status statd
statd start/running, process 942


But if it's not, you'll see something more like this:



$ status apache2
status: Unknown job: apache2


In this case, apache2 has not been converted to upstart. So, to disable apache2 you just run



sudo update-rc.d apache2 disable
sudo service apache2 stop


Disable services (jobs) in upstart



Upstart job definitions do not have an update-rc.d command. To disable the job, you need to edit the job file directly to disable it. There are two ways to do this.



If you want to still be able to manually start it, then you need to comment out the start on condition. Say you want to install samba, but not have it start automatically. Here is the job file (in natty):



description "SMB/CIFS File Server"
author "Steve Langasek <steve.langasek@ubuntu.com>"

start on local-filesystems
stop on runlevel [!2345]

respawn

pre-start script
RUN_MODE="daemons"

[ -r /etc/default/samba ] && . /etc/default/samba

[ "$RUN_MODE" = inetd ] && { stop; exit 0; }

install -o root -g root -m 755 -d /var/run/samba
end script

exec smbd -F


To disable samba, you can just put a # in front of the "start on local-filesystems". Note that while it won't start back up on boot, you still need to stop it this time with



sudo service smbd stop


If, however, you never want samba to start, I'd suggest actually removing the package. If, however, you want it installed, but not startable, you can also do:



mv /etc/init/smbd.conf /etc/init/smbd.conf.disabled


Disable a service using start/stop stanza (as of 11.04)



Starting with the version of upstart that will be in 11.04, there is a new keyword that disables the start on and stop on stanzas: manual. So another way to disable the service as of 11.04 is to do:



echo 'manual' | sudo tee /etc/init/mysql.override

# command from root shell
echo manual >> /etc/init/mysql.override


You can create an override file to disable a service without editing the job definition at all, by just putting the manual keyword in it.






share|improve this answer





















  • 20





    Looks like 11.04 has override too. So echo manual >> /etc/init/<service>.override is prefered as it leaves the original .conf filke intact. Anyway, its still a shame that such a basic enable/disable took 3 years to develop, and theres no GUI for that.

    – MestreLion
    May 27 '11 at 3:09






  • 3





    update-rc.d is what really matters

    – Tim
    Dec 2 '12 at 9:26






  • 2





    seems to much mor ehandle the original topic than the answer that has been tagged as the defintive answer by the original question poster. Thanks! :)

    – Henning
    Apr 6 '14 at 11:11






  • 1





    In my case, the file /etc/init/ssh.conf exists but status ssh and status sshd both say "Unknown job". This answer does not seem to address such a possibility?

    – Brian Z
    Jun 7 '15 at 3:33






  • 1





    status ssh gives me 'Unknown job', too, but service ssh status works for me

    – ptim
    Mar 27 '16 at 0:57



















124














sysv-rc-conf



Try using sysv-rc-conf



sudo apt-get install sysv-rc-conf


and to start managing the services, execute



sudo sysv-rc-conf


Which will bring up interactive window like this



enter image description here



You can further navigate through pages using Ctrl+n for next page and Ctrl+p for previous page. You can enable and disable services by selecting SPACE on desired runlevels.



Jobs-Admin



Another alternate would be Jobs-Admin by installing through



sudo apt-get install jobs-admin


Which also provides GUI like this



jobs-admin preview



For showing more jobs , you have to tick the Show Protected Jobs from its menu.



chkconfig



And third option would be chkconfig,



sudo apt-get install chkconfig


It can be used via CLI chkconfig, showing list of On/Off jobs.
Also we can view system services using chkconfig –list



Services can be turned on using



chkconfig <service> on


Services can be turned off using



chkconfig <service> off


And we can even add our own service, using a proper init script with proper headings.



chkconfig --add <service>


update-rc.d



And another option can be referred here update-rc.d , explained briefly here.



Note that for Ubuntu Server 12.04, update-rc.d is used instead of chkconfig.






share|improve this answer





















  • 1





    on ubuntu server: Package chkconfig is not available, but is referred to by another package.

    – pwned
    Apr 22 '13 at 13:16











  • @pwned You are free to edit and post the updated info regarding server edition.Thank you.

    – atenz
    Apr 26 '13 at 14:53











  • I did as you have suggested, now it is up for peer review.

    – pwned
    Apr 26 '13 at 16:44











  • jobs-admin doesn't allow to change jobs (Ubuntu 14.04), producing a crash report instead ;-)

    – Sadi
    May 20 '14 at 14:38






  • 5





    sysv-rc-conf isn't suitable for use with upstart or systemd, it patently being only for the old System 5 rc system, which hasn't been the default on Ubuntu Linux for almost a decade. Debian Bug #791689 acknowledges this and questions why it hasn't been marked as conflicting with systemd.

    – JdeBP
    Nov 17 '15 at 9:41





















48














For those of us who run Ubuntu over ssh, I think the nicest option is rcconf - a text based program:



sudo apt-get install rcconf
sudo rcconf


alt text



Navigate with tab and arrow keys, press spacebar to enable/disable. Changes are persistent across restarts.



Screenshot borrowed from this blogpost, which also shows sysv-rc-conf - a similar tool that also lets you set the runlevel. (For those who happen to care enough about runlevels to wish to change them :)



Unfortunately, rcconf doesn't work with upstart (services listed in /etc/init/*), just with the traditional mechanism (ls -l /etc/init.d/* - the ones that are not symbolic links).



Fortunately, many of the services that are relevant when ssh-ing in to a server (Apache, Tomcat, mdadm, boinc-client...) haven't been moved to upstart yet.






share|improve this answer





















  • 6





    Does this still work with upstart?

    – oKtosiTe
    Jan 6 '11 at 20:18






  • 3





    Unfortunately, no. But it has worked for all the cases I have wanted to change - the upstart jobs seems to be mostly things I never want to disable - hardware clock, log daemon, network etc. (on Ubuntu server, at least). But it's something to be aware of (I wasn't :), I've updated the post.

    – j-g-faustus
    Jan 6 '11 at 20:59











  • Unfortunately mysql was converted to upstart. And thats a service i only use when im doing some project.

    – MestreLion
    May 27 '11 at 3:12











  • There's a bug with rcconf on Ubuntu 12.04 that prevents the program from starting. To solve the issue you need to install the dialog package.

    – devius
    Jun 2 '12 at 22:08






  • 1





    Since this answer was written, update-rc.d was changed, and some of its deprecated functionality was removed. Debian bug #727735 notes that rcconf was not changed to match. And no, rcconf does not work with systemd either, thus not being applicable to either of the default init systems for Ubuntu Linux for the past decade.

    – JdeBP
    Nov 17 '15 at 9:35



















18














I found out that there is this GUI tool, something like BUM but compatible with Upstart:





  • Jobs-Admin



    sudo apt-get install jobs-admin







share|improve this answer


























  • But it is too simple, and do not allow to change "protected jobs" ( what is that jobbs? Apple has Jobs, operating system has daemons!)

    – kakaz
    Dec 19 '13 at 20:06











  • I doesn't even allow to change "unprotected jobs" (Ubuntu 14.04), producing a crash report instead ;-)

    – Sadi
    May 20 '14 at 14:37



















12














Editing the existing upstart configuration file (as described above) is not such a good idea. An updated package could provide an updated config, and you'd had to repeat your changes over and over.



By taking a look at man 5 init one will find a more appropriate solution: using an override config. Short example: Say we have a service called "foobar", so there would be a file called /etc/init/foobar.conf with its upstart configuration. Now you don't want to remove that file, nor to modify it -- but neither you want this service to run? So place an override file next to it: /etc/init/foobar.override, containing (optionally the header with the description and) instead the start on / stop on lines you place a line with one word: manual. This way you tell upstart to basically use the foobar.conf, but override the startup definition to only start that service when manually enforced (via service foobar start in our example).






share|improve this answer































    8














    There is also the Boot-Up Manager.



    To install: sudo apt-get install bum



    Further info: http://www.marzocca.net/linux/bum.html



    enter image description here






    share|improve this answer



















    • 1





      Dont forget to check the "Advanced" button.

      – not2qubit
      Feb 4 '16 at 2:10



















    0














    I use Stacer.
    It shows services and processes also. A complete GUI system toolbox.
    https://github.com/oguzhaninan/Stacer






    share|improve this answer































      8 Answers
      8






      active

      oldest

      votes








      8 Answers
      8






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      778














      There are services that can be enabled/disabled using the GUI (like the startup application) or the terminal.



      For the Terminal you have several options. First, open a terminal (Type "terminal" in the dash, for example, and open it). Then:



      Temporary enabling/disabling services



      To stop and start services temporarily (Does not enable / disable them for future boots), you can type service SERVICE_NAME. For example:




      • sudo service apache2 stop (Will STOP the Apache service until Reboot or until you start it again).


      • sudo service apache2 start (Will START the Apache service assuming it was stopped before.).


      • service apache2 status (Will tell you the STATUS of the service, if it is either enabled/running of disabled/NOT running.).


      • sudo service apache2 restart (Will RESTART the service. This is most commonly used when you have changed, a config file. In this case, if you changed either a PHP configuration or an Apache configuration. Restart will save you from having to stop/start with 2 command lines)


      • service apache2 (In this case, since you did not mention the ACTION to execute for the service, it will show you all options available for that specific service.) This aspect varies depending on the service, for example, with MySQL it would only mention that it is missing a parameter. For other services like networking service it would mention the small list of all options available.





      SYSTEMD



      Starting with Ubuntu 15.04, Upstart will be deprecated in favor of Systemd. With Systemd to manage the services we can do the following:



      systemctl start SERVICE - Use it to start a service. Does not persist after reboot



      systemctl stop SERVICE - Use it to stop a service. Does not persist after reboot



      systemctl restart SERVICE - Use it to restart a service



      systemctl reload SERVICE - If the service supports it, it will reload the config files related to it without interrupting any process that is using the service.



      systemctl status SERVICE - Shows the status of a service. Tells whether a service is currently running.



      systemctl enable SERVICE - Turns the service on, on the next reboot or on the next start event. It persists after reboot.



      systemctl disable SERVICE - Turns the service off on the next reboot or on the next stop event. It persists after reboot.



      systemctl is-enabled SERVICE - Check if a service is currently configured to start or not on the next reboot.



      systemctl is-active SERVICE - Check if a service is currently active.



      systemctl show SERVICE - Show all the information about the service.



      sudo systemctl mask SERVICE - Completely disable a service by linking it to /dev/null; you cannot start the service manually or enable the service.



      sudo systemctl unmask SERVICE - Removes the link to /dev/null and restores the ability to enable and or manually start the service.





      UPSTART (Deprecated Since 15.04)



      If we want to use the official Upstart way (Note that, for the moment, not all services have been converted to Upstart), we could use the following commands:



      status SERVICE - This will tell us if a converted service is running or not. Note that this is deprecated in favor of start, stop, status & restart. It will also tell us if a service has not yet been converted to upstart:



      A converted service would typically output the current status (Starting, Running, Stopping...) and process ID. A non converted service would give an error about an unknown job.



      Some shortcuts may only work with the service command above but not with the commands below unless they are 100% converted to upstart services:




      • START - sudo start mysql


      • STOP - sudo stop mysql


      • RESTART - sudo restart mysql


      • STATUS - sudo status smbd



      Enabling / Disabling a service



      To toggle a service from starting or stopping permanently you would need to:



      echo manual | sudo tee /etc/init/SERVICE.override


      where the stanza manual will stop Upstart from automatically loading the service on next boot. Any service with the .override ending will take precedence over the original service file. You will only be able to start the service manually afterwards. If you do not want this then simply delete the .override.
      For example:



      echo manual | sudo tee /etc/init/mysql.override


      Will put the MySQL service into manual mode. If you do not want this, afterwards you can simply do



      sudo rm /etc/init/mysql.override


      and Reboot for the service to start automatically again. Of course to enable a service, the most common way is by installing it. If you install Apache, Nginx, MySQL or others, they automatically start upon finishing installation and will start every time the computer boots. Disabling, as mentioned above, will make use of the service manual.






      share|improve this answer


























      • Do you need to add .service to every command? systemctl mongod status worked just fine.

        – Dan Dascalescu
        Sep 10 '16 at 3:36











      • @DanDascalescu no you don't but let me clarify that there.

        – Luis Alvarado
        Sep 10 '16 at 22:19






      • 4





        Should the .override file need to be placed in /etc/init.d/, i.e., where the service is placed?

        – Obi Wan - PallavJha
        Dec 9 '16 at 10:13











      • Why Upstart is deprecated in 15.04 ? what is the right way to run scripts on start/restart in ubuntu 16.04 or later ?

        – Kamalakannan J
        Jan 6 '17 at 20:18






      • 1





        Thanks for this comprehensive answer. The systemd set of commands works a treat on Ubuntu 18.04.

        – Doktor J
        Sep 24 '18 at 14:23
















      778














      There are services that can be enabled/disabled using the GUI (like the startup application) or the terminal.



      For the Terminal you have several options. First, open a terminal (Type "terminal" in the dash, for example, and open it). Then:



      Temporary enabling/disabling services



      To stop and start services temporarily (Does not enable / disable them for future boots), you can type service SERVICE_NAME. For example:




      • sudo service apache2 stop (Will STOP the Apache service until Reboot or until you start it again).


      • sudo service apache2 start (Will START the Apache service assuming it was stopped before.).


      • service apache2 status (Will tell you the STATUS of the service, if it is either enabled/running of disabled/NOT running.).


      • sudo service apache2 restart (Will RESTART the service. This is most commonly used when you have changed, a config file. In this case, if you changed either a PHP configuration or an Apache configuration. Restart will save you from having to stop/start with 2 command lines)


      • service apache2 (In this case, since you did not mention the ACTION to execute for the service, it will show you all options available for that specific service.) This aspect varies depending on the service, for example, with MySQL it would only mention that it is missing a parameter. For other services like networking service it would mention the small list of all options available.





      SYSTEMD



      Starting with Ubuntu 15.04, Upstart will be deprecated in favor of Systemd. With Systemd to manage the services we can do the following:



      systemctl start SERVICE - Use it to start a service. Does not persist after reboot



      systemctl stop SERVICE - Use it to stop a service. Does not persist after reboot



      systemctl restart SERVICE - Use it to restart a service



      systemctl reload SERVICE - If the service supports it, it will reload the config files related to it without interrupting any process that is using the service.



      systemctl status SERVICE - Shows the status of a service. Tells whether a service is currently running.



      systemctl enable SERVICE - Turns the service on, on the next reboot or on the next start event. It persists after reboot.



      systemctl disable SERVICE - Turns the service off on the next reboot or on the next stop event. It persists after reboot.



      systemctl is-enabled SERVICE - Check if a service is currently configured to start or not on the next reboot.



      systemctl is-active SERVICE - Check if a service is currently active.



      systemctl show SERVICE - Show all the information about the service.



      sudo systemctl mask SERVICE - Completely disable a service by linking it to /dev/null; you cannot start the service manually or enable the service.



      sudo systemctl unmask SERVICE - Removes the link to /dev/null and restores the ability to enable and or manually start the service.





      UPSTART (Deprecated Since 15.04)



      If we want to use the official Upstart way (Note that, for the moment, not all services have been converted to Upstart), we could use the following commands:



      status SERVICE - This will tell us if a converted service is running or not. Note that this is deprecated in favor of start, stop, status & restart. It will also tell us if a service has not yet been converted to upstart:



      A converted service would typically output the current status (Starting, Running, Stopping...) and process ID. A non converted service would give an error about an unknown job.



      Some shortcuts may only work with the service command above but not with the commands below unless they are 100% converted to upstart services:




      • START - sudo start mysql


      • STOP - sudo stop mysql


      • RESTART - sudo restart mysql


      • STATUS - sudo status smbd



      Enabling / Disabling a service



      To toggle a service from starting or stopping permanently you would need to:



      echo manual | sudo tee /etc/init/SERVICE.override


      where the stanza manual will stop Upstart from automatically loading the service on next boot. Any service with the .override ending will take precedence over the original service file. You will only be able to start the service manually afterwards. If you do not want this then simply delete the .override.
      For example:



      echo manual | sudo tee /etc/init/mysql.override


      Will put the MySQL service into manual mode. If you do not want this, afterwards you can simply do



      sudo rm /etc/init/mysql.override


      and Reboot for the service to start automatically again. Of course to enable a service, the most common way is by installing it. If you install Apache, Nginx, MySQL or others, they automatically start upon finishing installation and will start every time the computer boots. Disabling, as mentioned above, will make use of the service manual.






      share|improve this answer


























      • Do you need to add .service to every command? systemctl mongod status worked just fine.

        – Dan Dascalescu
        Sep 10 '16 at 3:36











      • @DanDascalescu no you don't but let me clarify that there.

        – Luis Alvarado
        Sep 10 '16 at 22:19






      • 4





        Should the .override file need to be placed in /etc/init.d/, i.e., where the service is placed?

        – Obi Wan - PallavJha
        Dec 9 '16 at 10:13











      • Why Upstart is deprecated in 15.04 ? what is the right way to run scripts on start/restart in ubuntu 16.04 or later ?

        – Kamalakannan J
        Jan 6 '17 at 20:18






      • 1





        Thanks for this comprehensive answer. The systemd set of commands works a treat on Ubuntu 18.04.

        – Doktor J
        Sep 24 '18 at 14:23














      778












      778








      778







      There are services that can be enabled/disabled using the GUI (like the startup application) or the terminal.



      For the Terminal you have several options. First, open a terminal (Type "terminal" in the dash, for example, and open it). Then:



      Temporary enabling/disabling services



      To stop and start services temporarily (Does not enable / disable them for future boots), you can type service SERVICE_NAME. For example:




      • sudo service apache2 stop (Will STOP the Apache service until Reboot or until you start it again).


      • sudo service apache2 start (Will START the Apache service assuming it was stopped before.).


      • service apache2 status (Will tell you the STATUS of the service, if it is either enabled/running of disabled/NOT running.).


      • sudo service apache2 restart (Will RESTART the service. This is most commonly used when you have changed, a config file. In this case, if you changed either a PHP configuration or an Apache configuration. Restart will save you from having to stop/start with 2 command lines)


      • service apache2 (In this case, since you did not mention the ACTION to execute for the service, it will show you all options available for that specific service.) This aspect varies depending on the service, for example, with MySQL it would only mention that it is missing a parameter. For other services like networking service it would mention the small list of all options available.





      SYSTEMD



      Starting with Ubuntu 15.04, Upstart will be deprecated in favor of Systemd. With Systemd to manage the services we can do the following:



      systemctl start SERVICE - Use it to start a service. Does not persist after reboot



      systemctl stop SERVICE - Use it to stop a service. Does not persist after reboot



      systemctl restart SERVICE - Use it to restart a service



      systemctl reload SERVICE - If the service supports it, it will reload the config files related to it without interrupting any process that is using the service.



      systemctl status SERVICE - Shows the status of a service. Tells whether a service is currently running.



      systemctl enable SERVICE - Turns the service on, on the next reboot or on the next start event. It persists after reboot.



      systemctl disable SERVICE - Turns the service off on the next reboot or on the next stop event. It persists after reboot.



      systemctl is-enabled SERVICE - Check if a service is currently configured to start or not on the next reboot.



      systemctl is-active SERVICE - Check if a service is currently active.



      systemctl show SERVICE - Show all the information about the service.



      sudo systemctl mask SERVICE - Completely disable a service by linking it to /dev/null; you cannot start the service manually or enable the service.



      sudo systemctl unmask SERVICE - Removes the link to /dev/null and restores the ability to enable and or manually start the service.





      UPSTART (Deprecated Since 15.04)



      If we want to use the official Upstart way (Note that, for the moment, not all services have been converted to Upstart), we could use the following commands:



      status SERVICE - This will tell us if a converted service is running or not. Note that this is deprecated in favor of start, stop, status & restart. It will also tell us if a service has not yet been converted to upstart:



      A converted service would typically output the current status (Starting, Running, Stopping...) and process ID. A non converted service would give an error about an unknown job.



      Some shortcuts may only work with the service command above but not with the commands below unless they are 100% converted to upstart services:




      • START - sudo start mysql


      • STOP - sudo stop mysql


      • RESTART - sudo restart mysql


      • STATUS - sudo status smbd



      Enabling / Disabling a service



      To toggle a service from starting or stopping permanently you would need to:



      echo manual | sudo tee /etc/init/SERVICE.override


      where the stanza manual will stop Upstart from automatically loading the service on next boot. Any service with the .override ending will take precedence over the original service file. You will only be able to start the service manually afterwards. If you do not want this then simply delete the .override.
      For example:



      echo manual | sudo tee /etc/init/mysql.override


      Will put the MySQL service into manual mode. If you do not want this, afterwards you can simply do



      sudo rm /etc/init/mysql.override


      and Reboot for the service to start automatically again. Of course to enable a service, the most common way is by installing it. If you install Apache, Nginx, MySQL or others, they automatically start upon finishing installation and will start every time the computer boots. Disabling, as mentioned above, will make use of the service manual.






      share|improve this answer















      There are services that can be enabled/disabled using the GUI (like the startup application) or the terminal.



      For the Terminal you have several options. First, open a terminal (Type "terminal" in the dash, for example, and open it). Then:



      Temporary enabling/disabling services



      To stop and start services temporarily (Does not enable / disable them for future boots), you can type service SERVICE_NAME. For example:




      • sudo service apache2 stop (Will STOP the Apache service until Reboot or until you start it again).


      • sudo service apache2 start (Will START the Apache service assuming it was stopped before.).


      • service apache2 status (Will tell you the STATUS of the service, if it is either enabled/running of disabled/NOT running.).


      • sudo service apache2 restart (Will RESTART the service. This is most commonly used when you have changed, a config file. In this case, if you changed either a PHP configuration or an Apache configuration. Restart will save you from having to stop/start with 2 command lines)


      • service apache2 (In this case, since you did not mention the ACTION to execute for the service, it will show you all options available for that specific service.) This aspect varies depending on the service, for example, with MySQL it would only mention that it is missing a parameter. For other services like networking service it would mention the small list of all options available.





      SYSTEMD



      Starting with Ubuntu 15.04, Upstart will be deprecated in favor of Systemd. With Systemd to manage the services we can do the following:



      systemctl start SERVICE - Use it to start a service. Does not persist after reboot



      systemctl stop SERVICE - Use it to stop a service. Does not persist after reboot



      systemctl restart SERVICE - Use it to restart a service



      systemctl reload SERVICE - If the service supports it, it will reload the config files related to it without interrupting any process that is using the service.



      systemctl status SERVICE - Shows the status of a service. Tells whether a service is currently running.



      systemctl enable SERVICE - Turns the service on, on the next reboot or on the next start event. It persists after reboot.



      systemctl disable SERVICE - Turns the service off on the next reboot or on the next stop event. It persists after reboot.



      systemctl is-enabled SERVICE - Check if a service is currently configured to start or not on the next reboot.



      systemctl is-active SERVICE - Check if a service is currently active.



      systemctl show SERVICE - Show all the information about the service.



      sudo systemctl mask SERVICE - Completely disable a service by linking it to /dev/null; you cannot start the service manually or enable the service.



      sudo systemctl unmask SERVICE - Removes the link to /dev/null and restores the ability to enable and or manually start the service.





      UPSTART (Deprecated Since 15.04)



      If we want to use the official Upstart way (Note that, for the moment, not all services have been converted to Upstart), we could use the following commands:



      status SERVICE - This will tell us if a converted service is running or not. Note that this is deprecated in favor of start, stop, status & restart. It will also tell us if a service has not yet been converted to upstart:



      A converted service would typically output the current status (Starting, Running, Stopping...) and process ID. A non converted service would give an error about an unknown job.



      Some shortcuts may only work with the service command above but not with the commands below unless they are 100% converted to upstart services:




      • START - sudo start mysql


      • STOP - sudo stop mysql


      • RESTART - sudo restart mysql


      • STATUS - sudo status smbd



      Enabling / Disabling a service



      To toggle a service from starting or stopping permanently you would need to:



      echo manual | sudo tee /etc/init/SERVICE.override


      where the stanza manual will stop Upstart from automatically loading the service on next boot. Any service with the .override ending will take precedence over the original service file. You will only be able to start the service manually afterwards. If you do not want this then simply delete the .override.
      For example:



      echo manual | sudo tee /etc/init/mysql.override


      Will put the MySQL service into manual mode. If you do not want this, afterwards you can simply do



      sudo rm /etc/init/mysql.override


      and Reboot for the service to start automatically again. Of course to enable a service, the most common way is by installing it. If you install Apache, Nginx, MySQL or others, they automatically start upon finishing installation and will start every time the computer boots. Disabling, as mentioned above, will make use of the service manual.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jan 27 '17 at 2:59









      muru

      1




      1










      answered Dec 29 '10 at 21:26









      Luis AlvaradoLuis Alvarado

      145k135485652




      145k135485652













      • Do you need to add .service to every command? systemctl mongod status worked just fine.

        – Dan Dascalescu
        Sep 10 '16 at 3:36











      • @DanDascalescu no you don't but let me clarify that there.

        – Luis Alvarado
        Sep 10 '16 at 22:19






      • 4





        Should the .override file need to be placed in /etc/init.d/, i.e., where the service is placed?

        – Obi Wan - PallavJha
        Dec 9 '16 at 10:13











      • Why Upstart is deprecated in 15.04 ? what is the right way to run scripts on start/restart in ubuntu 16.04 or later ?

        – Kamalakannan J
        Jan 6 '17 at 20:18






      • 1





        Thanks for this comprehensive answer. The systemd set of commands works a treat on Ubuntu 18.04.

        – Doktor J
        Sep 24 '18 at 14:23



















      • Do you need to add .service to every command? systemctl mongod status worked just fine.

        – Dan Dascalescu
        Sep 10 '16 at 3:36











      • @DanDascalescu no you don't but let me clarify that there.

        – Luis Alvarado
        Sep 10 '16 at 22:19






      • 4





        Should the .override file need to be placed in /etc/init.d/, i.e., where the service is placed?

        – Obi Wan - PallavJha
        Dec 9 '16 at 10:13











      • Why Upstart is deprecated in 15.04 ? what is the right way to run scripts on start/restart in ubuntu 16.04 or later ?

        – Kamalakannan J
        Jan 6 '17 at 20:18






      • 1





        Thanks for this comprehensive answer. The systemd set of commands works a treat on Ubuntu 18.04.

        – Doktor J
        Sep 24 '18 at 14:23

















      Do you need to add .service to every command? systemctl mongod status worked just fine.

      – Dan Dascalescu
      Sep 10 '16 at 3:36





      Do you need to add .service to every command? systemctl mongod status worked just fine.

      – Dan Dascalescu
      Sep 10 '16 at 3:36













      @DanDascalescu no you don't but let me clarify that there.

      – Luis Alvarado
      Sep 10 '16 at 22:19





      @DanDascalescu no you don't but let me clarify that there.

      – Luis Alvarado
      Sep 10 '16 at 22:19




      4




      4





      Should the .override file need to be placed in /etc/init.d/, i.e., where the service is placed?

      – Obi Wan - PallavJha
      Dec 9 '16 at 10:13





      Should the .override file need to be placed in /etc/init.d/, i.e., where the service is placed?

      – Obi Wan - PallavJha
      Dec 9 '16 at 10:13













      Why Upstart is deprecated in 15.04 ? what is the right way to run scripts on start/restart in ubuntu 16.04 or later ?

      – Kamalakannan J
      Jan 6 '17 at 20:18





      Why Upstart is deprecated in 15.04 ? what is the right way to run scripts on start/restart in ubuntu 16.04 or later ?

      – Kamalakannan J
      Jan 6 '17 at 20:18




      1




      1





      Thanks for this comprehensive answer. The systemd set of commands works a treat on Ubuntu 18.04.

      – Doktor J
      Sep 24 '18 at 14:23





      Thanks for this comprehensive answer. The systemd set of commands works a treat on Ubuntu 18.04.

      – Doktor J
      Sep 24 '18 at 14:23













      340





      +150









      Currently there are actually three different ways for software to be started as a service in Ubuntu, SysV, Upstart and systemd. A service is defined here as a program run by the system in the background, as opposed to one started and run directly by the user.



      SysV



      The traditional way to start services in Linux was to place a script in /etc/init.d, and then use the update-rc.d command (or in RedHat based distros, chkconfig) to enable or disable it.



      This command uses some mildly complicated logic to create symlinks in /etc/rc#.d, that control the order of starting services. If you run ls /etc/rc2.d you can see the order that services will be killed with a file name like K##xxxx and started with file names S##xxxx. The ## in S##xxxx means a "start order" for service xxxx. Conversely, the ## in K##xxxx means the kill order for service xxxx.



      One major issue with SysV was that when booting the system, everything had to be done in serial, one thing after another, making system boot times really slow. Attempts were made to parallelize this, but they were haphazard and hard to take full advantage of. This was the main reason that Upstart was created.



      Upstart



      Upstart uses job definition files in /etc/init to define on what events a service should be started. So, while the system is booting, upstart processes various events, and then can start multiple services in parallel. This allows them to fully utilize the resources of the system, for instance, by starting a disk-bound service up while another CPU-bound service runs, or while the network is waiting for a dynamic IP address to be assigned.



      You can see all of the upstart job files by running ls /etc/init/*.conf



      Let me just stop here and say that if you don't know what a service is, or what it does, DO NOT disable it!



      Not all services have been converted to upstart. While working on the server team at Canonical for the past few months, I've worked on a number of converted job files, and the nicest part is that it allows one to get rid of all the script "magic" and just put in a few commands here and there to define exactly how to start the service, and nothing more. But for now, only a handful of traditional network services, like squid and samba, have been converted.



      Is a service upstart-based?



      In order to figure out if a service is upstart-based, you can run the status command:



      status servicename


      If it's an upstart job, it will show this:



      $ status statd
      statd start/running, process 942


      But if it's not, you'll see something more like this:



      $ status apache2
      status: Unknown job: apache2


      In this case, apache2 has not been converted to upstart. So, to disable apache2 you just run



      sudo update-rc.d apache2 disable
      sudo service apache2 stop


      Disable services (jobs) in upstart



      Upstart job definitions do not have an update-rc.d command. To disable the job, you need to edit the job file directly to disable it. There are two ways to do this.



      If you want to still be able to manually start it, then you need to comment out the start on condition. Say you want to install samba, but not have it start automatically. Here is the job file (in natty):



      description "SMB/CIFS File Server"
      author "Steve Langasek <steve.langasek@ubuntu.com>"

      start on local-filesystems
      stop on runlevel [!2345]

      respawn

      pre-start script
      RUN_MODE="daemons"

      [ -r /etc/default/samba ] && . /etc/default/samba

      [ "$RUN_MODE" = inetd ] && { stop; exit 0; }

      install -o root -g root -m 755 -d /var/run/samba
      end script

      exec smbd -F


      To disable samba, you can just put a # in front of the "start on local-filesystems". Note that while it won't start back up on boot, you still need to stop it this time with



      sudo service smbd stop


      If, however, you never want samba to start, I'd suggest actually removing the package. If, however, you want it installed, but not startable, you can also do:



      mv /etc/init/smbd.conf /etc/init/smbd.conf.disabled


      Disable a service using start/stop stanza (as of 11.04)



      Starting with the version of upstart that will be in 11.04, there is a new keyword that disables the start on and stop on stanzas: manual. So another way to disable the service as of 11.04 is to do:



      echo 'manual' | sudo tee /etc/init/mysql.override

      # command from root shell
      echo manual >> /etc/init/mysql.override


      You can create an override file to disable a service without editing the job definition at all, by just putting the manual keyword in it.






      share|improve this answer





















      • 20





        Looks like 11.04 has override too. So echo manual >> /etc/init/<service>.override is prefered as it leaves the original .conf filke intact. Anyway, its still a shame that such a basic enable/disable took 3 years to develop, and theres no GUI for that.

        – MestreLion
        May 27 '11 at 3:09






      • 3





        update-rc.d is what really matters

        – Tim
        Dec 2 '12 at 9:26






      • 2





        seems to much mor ehandle the original topic than the answer that has been tagged as the defintive answer by the original question poster. Thanks! :)

        – Henning
        Apr 6 '14 at 11:11






      • 1





        In my case, the file /etc/init/ssh.conf exists but status ssh and status sshd both say "Unknown job". This answer does not seem to address such a possibility?

        – Brian Z
        Jun 7 '15 at 3:33






      • 1





        status ssh gives me 'Unknown job', too, but service ssh status works for me

        – ptim
        Mar 27 '16 at 0:57
















      340





      +150









      Currently there are actually three different ways for software to be started as a service in Ubuntu, SysV, Upstart and systemd. A service is defined here as a program run by the system in the background, as opposed to one started and run directly by the user.



      SysV



      The traditional way to start services in Linux was to place a script in /etc/init.d, and then use the update-rc.d command (or in RedHat based distros, chkconfig) to enable or disable it.



      This command uses some mildly complicated logic to create symlinks in /etc/rc#.d, that control the order of starting services. If you run ls /etc/rc2.d you can see the order that services will be killed with a file name like K##xxxx and started with file names S##xxxx. The ## in S##xxxx means a "start order" for service xxxx. Conversely, the ## in K##xxxx means the kill order for service xxxx.



      One major issue with SysV was that when booting the system, everything had to be done in serial, one thing after another, making system boot times really slow. Attempts were made to parallelize this, but they were haphazard and hard to take full advantage of. This was the main reason that Upstart was created.



      Upstart



      Upstart uses job definition files in /etc/init to define on what events a service should be started. So, while the system is booting, upstart processes various events, and then can start multiple services in parallel. This allows them to fully utilize the resources of the system, for instance, by starting a disk-bound service up while another CPU-bound service runs, or while the network is waiting for a dynamic IP address to be assigned.



      You can see all of the upstart job files by running ls /etc/init/*.conf



      Let me just stop here and say that if you don't know what a service is, or what it does, DO NOT disable it!



      Not all services have been converted to upstart. While working on the server team at Canonical for the past few months, I've worked on a number of converted job files, and the nicest part is that it allows one to get rid of all the script "magic" and just put in a few commands here and there to define exactly how to start the service, and nothing more. But for now, only a handful of traditional network services, like squid and samba, have been converted.



      Is a service upstart-based?



      In order to figure out if a service is upstart-based, you can run the status command:



      status servicename


      If it's an upstart job, it will show this:



      $ status statd
      statd start/running, process 942


      But if it's not, you'll see something more like this:



      $ status apache2
      status: Unknown job: apache2


      In this case, apache2 has not been converted to upstart. So, to disable apache2 you just run



      sudo update-rc.d apache2 disable
      sudo service apache2 stop


      Disable services (jobs) in upstart



      Upstart job definitions do not have an update-rc.d command. To disable the job, you need to edit the job file directly to disable it. There are two ways to do this.



      If you want to still be able to manually start it, then you need to comment out the start on condition. Say you want to install samba, but not have it start automatically. Here is the job file (in natty):



      description "SMB/CIFS File Server"
      author "Steve Langasek <steve.langasek@ubuntu.com>"

      start on local-filesystems
      stop on runlevel [!2345]

      respawn

      pre-start script
      RUN_MODE="daemons"

      [ -r /etc/default/samba ] && . /etc/default/samba

      [ "$RUN_MODE" = inetd ] && { stop; exit 0; }

      install -o root -g root -m 755 -d /var/run/samba
      end script

      exec smbd -F


      To disable samba, you can just put a # in front of the "start on local-filesystems". Note that while it won't start back up on boot, you still need to stop it this time with



      sudo service smbd stop


      If, however, you never want samba to start, I'd suggest actually removing the package. If, however, you want it installed, but not startable, you can also do:



      mv /etc/init/smbd.conf /etc/init/smbd.conf.disabled


      Disable a service using start/stop stanza (as of 11.04)



      Starting with the version of upstart that will be in 11.04, there is a new keyword that disables the start on and stop on stanzas: manual. So another way to disable the service as of 11.04 is to do:



      echo 'manual' | sudo tee /etc/init/mysql.override

      # command from root shell
      echo manual >> /etc/init/mysql.override


      You can create an override file to disable a service without editing the job definition at all, by just putting the manual keyword in it.






      share|improve this answer





















      • 20





        Looks like 11.04 has override too. So echo manual >> /etc/init/<service>.override is prefered as it leaves the original .conf filke intact. Anyway, its still a shame that such a basic enable/disable took 3 years to develop, and theres no GUI for that.

        – MestreLion
        May 27 '11 at 3:09






      • 3





        update-rc.d is what really matters

        – Tim
        Dec 2 '12 at 9:26






      • 2





        seems to much mor ehandle the original topic than the answer that has been tagged as the defintive answer by the original question poster. Thanks! :)

        – Henning
        Apr 6 '14 at 11:11






      • 1





        In my case, the file /etc/init/ssh.conf exists but status ssh and status sshd both say "Unknown job". This answer does not seem to address such a possibility?

        – Brian Z
        Jun 7 '15 at 3:33






      • 1





        status ssh gives me 'Unknown job', too, but service ssh status works for me

        – ptim
        Mar 27 '16 at 0:57














      340





      +150







      340





      +150



      340




      +150





      Currently there are actually three different ways for software to be started as a service in Ubuntu, SysV, Upstart and systemd. A service is defined here as a program run by the system in the background, as opposed to one started and run directly by the user.



      SysV



      The traditional way to start services in Linux was to place a script in /etc/init.d, and then use the update-rc.d command (or in RedHat based distros, chkconfig) to enable or disable it.



      This command uses some mildly complicated logic to create symlinks in /etc/rc#.d, that control the order of starting services. If you run ls /etc/rc2.d you can see the order that services will be killed with a file name like K##xxxx and started with file names S##xxxx. The ## in S##xxxx means a "start order" for service xxxx. Conversely, the ## in K##xxxx means the kill order for service xxxx.



      One major issue with SysV was that when booting the system, everything had to be done in serial, one thing after another, making system boot times really slow. Attempts were made to parallelize this, but they were haphazard and hard to take full advantage of. This was the main reason that Upstart was created.



      Upstart



      Upstart uses job definition files in /etc/init to define on what events a service should be started. So, while the system is booting, upstart processes various events, and then can start multiple services in parallel. This allows them to fully utilize the resources of the system, for instance, by starting a disk-bound service up while another CPU-bound service runs, or while the network is waiting for a dynamic IP address to be assigned.



      You can see all of the upstart job files by running ls /etc/init/*.conf



      Let me just stop here and say that if you don't know what a service is, or what it does, DO NOT disable it!



      Not all services have been converted to upstart. While working on the server team at Canonical for the past few months, I've worked on a number of converted job files, and the nicest part is that it allows one to get rid of all the script "magic" and just put in a few commands here and there to define exactly how to start the service, and nothing more. But for now, only a handful of traditional network services, like squid and samba, have been converted.



      Is a service upstart-based?



      In order to figure out if a service is upstart-based, you can run the status command:



      status servicename


      If it's an upstart job, it will show this:



      $ status statd
      statd start/running, process 942


      But if it's not, you'll see something more like this:



      $ status apache2
      status: Unknown job: apache2


      In this case, apache2 has not been converted to upstart. So, to disable apache2 you just run



      sudo update-rc.d apache2 disable
      sudo service apache2 stop


      Disable services (jobs) in upstart



      Upstart job definitions do not have an update-rc.d command. To disable the job, you need to edit the job file directly to disable it. There are two ways to do this.



      If you want to still be able to manually start it, then you need to comment out the start on condition. Say you want to install samba, but not have it start automatically. Here is the job file (in natty):



      description "SMB/CIFS File Server"
      author "Steve Langasek <steve.langasek@ubuntu.com>"

      start on local-filesystems
      stop on runlevel [!2345]

      respawn

      pre-start script
      RUN_MODE="daemons"

      [ -r /etc/default/samba ] && . /etc/default/samba

      [ "$RUN_MODE" = inetd ] && { stop; exit 0; }

      install -o root -g root -m 755 -d /var/run/samba
      end script

      exec smbd -F


      To disable samba, you can just put a # in front of the "start on local-filesystems". Note that while it won't start back up on boot, you still need to stop it this time with



      sudo service smbd stop


      If, however, you never want samba to start, I'd suggest actually removing the package. If, however, you want it installed, but not startable, you can also do:



      mv /etc/init/smbd.conf /etc/init/smbd.conf.disabled


      Disable a service using start/stop stanza (as of 11.04)



      Starting with the version of upstart that will be in 11.04, there is a new keyword that disables the start on and stop on stanzas: manual. So another way to disable the service as of 11.04 is to do:



      echo 'manual' | sudo tee /etc/init/mysql.override

      # command from root shell
      echo manual >> /etc/init/mysql.override


      You can create an override file to disable a service without editing the job definition at all, by just putting the manual keyword in it.






      share|improve this answer















      Currently there are actually three different ways for software to be started as a service in Ubuntu, SysV, Upstart and systemd. A service is defined here as a program run by the system in the background, as opposed to one started and run directly by the user.



      SysV



      The traditional way to start services in Linux was to place a script in /etc/init.d, and then use the update-rc.d command (or in RedHat based distros, chkconfig) to enable or disable it.



      This command uses some mildly complicated logic to create symlinks in /etc/rc#.d, that control the order of starting services. If you run ls /etc/rc2.d you can see the order that services will be killed with a file name like K##xxxx and started with file names S##xxxx. The ## in S##xxxx means a "start order" for service xxxx. Conversely, the ## in K##xxxx means the kill order for service xxxx.



      One major issue with SysV was that when booting the system, everything had to be done in serial, one thing after another, making system boot times really slow. Attempts were made to parallelize this, but they were haphazard and hard to take full advantage of. This was the main reason that Upstart was created.



      Upstart



      Upstart uses job definition files in /etc/init to define on what events a service should be started. So, while the system is booting, upstart processes various events, and then can start multiple services in parallel. This allows them to fully utilize the resources of the system, for instance, by starting a disk-bound service up while another CPU-bound service runs, or while the network is waiting for a dynamic IP address to be assigned.



      You can see all of the upstart job files by running ls /etc/init/*.conf



      Let me just stop here and say that if you don't know what a service is, or what it does, DO NOT disable it!



      Not all services have been converted to upstart. While working on the server team at Canonical for the past few months, I've worked on a number of converted job files, and the nicest part is that it allows one to get rid of all the script "magic" and just put in a few commands here and there to define exactly how to start the service, and nothing more. But for now, only a handful of traditional network services, like squid and samba, have been converted.



      Is a service upstart-based?



      In order to figure out if a service is upstart-based, you can run the status command:



      status servicename


      If it's an upstart job, it will show this:



      $ status statd
      statd start/running, process 942


      But if it's not, you'll see something more like this:



      $ status apache2
      status: Unknown job: apache2


      In this case, apache2 has not been converted to upstart. So, to disable apache2 you just run



      sudo update-rc.d apache2 disable
      sudo service apache2 stop


      Disable services (jobs) in upstart



      Upstart job definitions do not have an update-rc.d command. To disable the job, you need to edit the job file directly to disable it. There are two ways to do this.



      If you want to still be able to manually start it, then you need to comment out the start on condition. Say you want to install samba, but not have it start automatically. Here is the job file (in natty):



      description "SMB/CIFS File Server"
      author "Steve Langasek <steve.langasek@ubuntu.com>"

      start on local-filesystems
      stop on runlevel [!2345]

      respawn

      pre-start script
      RUN_MODE="daemons"

      [ -r /etc/default/samba ] && . /etc/default/samba

      [ "$RUN_MODE" = inetd ] && { stop; exit 0; }

      install -o root -g root -m 755 -d /var/run/samba
      end script

      exec smbd -F


      To disable samba, you can just put a # in front of the "start on local-filesystems". Note that while it won't start back up on boot, you still need to stop it this time with



      sudo service smbd stop


      If, however, you never want samba to start, I'd suggest actually removing the package. If, however, you want it installed, but not startable, you can also do:



      mv /etc/init/smbd.conf /etc/init/smbd.conf.disabled


      Disable a service using start/stop stanza (as of 11.04)



      Starting with the version of upstart that will be in 11.04, there is a new keyword that disables the start on and stop on stanzas: manual. So another way to disable the service as of 11.04 is to do:



      echo 'manual' | sudo tee /etc/init/mysql.override

      # command from root shell
      echo manual >> /etc/init/mysql.override


      You can create an override file to disable a service without editing the job definition at all, by just putting the manual keyword in it.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Apr 11 '16 at 5:55









      muru

      1




      1










      answered Jan 6 '11 at 18:25









      SpamapSSpamapS

      15.9k42649




      15.9k42649








      • 20





        Looks like 11.04 has override too. So echo manual >> /etc/init/<service>.override is prefered as it leaves the original .conf filke intact. Anyway, its still a shame that such a basic enable/disable took 3 years to develop, and theres no GUI for that.

        – MestreLion
        May 27 '11 at 3:09






      • 3





        update-rc.d is what really matters

        – Tim
        Dec 2 '12 at 9:26






      • 2





        seems to much mor ehandle the original topic than the answer that has been tagged as the defintive answer by the original question poster. Thanks! :)

        – Henning
        Apr 6 '14 at 11:11






      • 1





        In my case, the file /etc/init/ssh.conf exists but status ssh and status sshd both say "Unknown job". This answer does not seem to address such a possibility?

        – Brian Z
        Jun 7 '15 at 3:33






      • 1





        status ssh gives me 'Unknown job', too, but service ssh status works for me

        – ptim
        Mar 27 '16 at 0:57














      • 20





        Looks like 11.04 has override too. So echo manual >> /etc/init/<service>.override is prefered as it leaves the original .conf filke intact. Anyway, its still a shame that such a basic enable/disable took 3 years to develop, and theres no GUI for that.

        – MestreLion
        May 27 '11 at 3:09






      • 3





        update-rc.d is what really matters

        – Tim
        Dec 2 '12 at 9:26






      • 2





        seems to much mor ehandle the original topic than the answer that has been tagged as the defintive answer by the original question poster. Thanks! :)

        – Henning
        Apr 6 '14 at 11:11






      • 1





        In my case, the file /etc/init/ssh.conf exists but status ssh and status sshd both say "Unknown job". This answer does not seem to address such a possibility?

        – Brian Z
        Jun 7 '15 at 3:33






      • 1





        status ssh gives me 'Unknown job', too, but service ssh status works for me

        – ptim
        Mar 27 '16 at 0:57








      20




      20





      Looks like 11.04 has override too. So echo manual >> /etc/init/<service>.override is prefered as it leaves the original .conf filke intact. Anyway, its still a shame that such a basic enable/disable took 3 years to develop, and theres no GUI for that.

      – MestreLion
      May 27 '11 at 3:09





      Looks like 11.04 has override too. So echo manual >> /etc/init/<service>.override is prefered as it leaves the original .conf filke intact. Anyway, its still a shame that such a basic enable/disable took 3 years to develop, and theres no GUI for that.

      – MestreLion
      May 27 '11 at 3:09




      3




      3





      update-rc.d is what really matters

      – Tim
      Dec 2 '12 at 9:26





      update-rc.d is what really matters

      – Tim
      Dec 2 '12 at 9:26




      2




      2





      seems to much mor ehandle the original topic than the answer that has been tagged as the defintive answer by the original question poster. Thanks! :)

      – Henning
      Apr 6 '14 at 11:11





      seems to much mor ehandle the original topic than the answer that has been tagged as the defintive answer by the original question poster. Thanks! :)

      – Henning
      Apr 6 '14 at 11:11




      1




      1





      In my case, the file /etc/init/ssh.conf exists but status ssh and status sshd both say "Unknown job". This answer does not seem to address such a possibility?

      – Brian Z
      Jun 7 '15 at 3:33





      In my case, the file /etc/init/ssh.conf exists but status ssh and status sshd both say "Unknown job". This answer does not seem to address such a possibility?

      – Brian Z
      Jun 7 '15 at 3:33




      1




      1





      status ssh gives me 'Unknown job', too, but service ssh status works for me

      – ptim
      Mar 27 '16 at 0:57





      status ssh gives me 'Unknown job', too, but service ssh status works for me

      – ptim
      Mar 27 '16 at 0:57











      124














      sysv-rc-conf



      Try using sysv-rc-conf



      sudo apt-get install sysv-rc-conf


      and to start managing the services, execute



      sudo sysv-rc-conf


      Which will bring up interactive window like this



      enter image description here



      You can further navigate through pages using Ctrl+n for next page and Ctrl+p for previous page. You can enable and disable services by selecting SPACE on desired runlevels.



      Jobs-Admin



      Another alternate would be Jobs-Admin by installing through



      sudo apt-get install jobs-admin


      Which also provides GUI like this



      jobs-admin preview



      For showing more jobs , you have to tick the Show Protected Jobs from its menu.



      chkconfig



      And third option would be chkconfig,



      sudo apt-get install chkconfig


      It can be used via CLI chkconfig, showing list of On/Off jobs.
      Also we can view system services using chkconfig –list



      Services can be turned on using



      chkconfig <service> on


      Services can be turned off using



      chkconfig <service> off


      And we can even add our own service, using a proper init script with proper headings.



      chkconfig --add <service>


      update-rc.d



      And another option can be referred here update-rc.d , explained briefly here.



      Note that for Ubuntu Server 12.04, update-rc.d is used instead of chkconfig.






      share|improve this answer





















      • 1





        on ubuntu server: Package chkconfig is not available, but is referred to by another package.

        – pwned
        Apr 22 '13 at 13:16











      • @pwned You are free to edit and post the updated info regarding server edition.Thank you.

        – atenz
        Apr 26 '13 at 14:53











      • I did as you have suggested, now it is up for peer review.

        – pwned
        Apr 26 '13 at 16:44











      • jobs-admin doesn't allow to change jobs (Ubuntu 14.04), producing a crash report instead ;-)

        – Sadi
        May 20 '14 at 14:38






      • 5





        sysv-rc-conf isn't suitable for use with upstart or systemd, it patently being only for the old System 5 rc system, which hasn't been the default on Ubuntu Linux for almost a decade. Debian Bug #791689 acknowledges this and questions why it hasn't been marked as conflicting with systemd.

        – JdeBP
        Nov 17 '15 at 9:41


















      124














      sysv-rc-conf



      Try using sysv-rc-conf



      sudo apt-get install sysv-rc-conf


      and to start managing the services, execute



      sudo sysv-rc-conf


      Which will bring up interactive window like this



      enter image description here



      You can further navigate through pages using Ctrl+n for next page and Ctrl+p for previous page. You can enable and disable services by selecting SPACE on desired runlevels.



      Jobs-Admin



      Another alternate would be Jobs-Admin by installing through



      sudo apt-get install jobs-admin


      Which also provides GUI like this



      jobs-admin preview



      For showing more jobs , you have to tick the Show Protected Jobs from its menu.



      chkconfig



      And third option would be chkconfig,



      sudo apt-get install chkconfig


      It can be used via CLI chkconfig, showing list of On/Off jobs.
      Also we can view system services using chkconfig –list



      Services can be turned on using



      chkconfig <service> on


      Services can be turned off using



      chkconfig <service> off


      And we can even add our own service, using a proper init script with proper headings.



      chkconfig --add <service>


      update-rc.d



      And another option can be referred here update-rc.d , explained briefly here.



      Note that for Ubuntu Server 12.04, update-rc.d is used instead of chkconfig.






      share|improve this answer





















      • 1





        on ubuntu server: Package chkconfig is not available, but is referred to by another package.

        – pwned
        Apr 22 '13 at 13:16











      • @pwned You are free to edit and post the updated info regarding server edition.Thank you.

        – atenz
        Apr 26 '13 at 14:53











      • I did as you have suggested, now it is up for peer review.

        – pwned
        Apr 26 '13 at 16:44











      • jobs-admin doesn't allow to change jobs (Ubuntu 14.04), producing a crash report instead ;-)

        – Sadi
        May 20 '14 at 14:38






      • 5





        sysv-rc-conf isn't suitable for use with upstart or systemd, it patently being only for the old System 5 rc system, which hasn't been the default on Ubuntu Linux for almost a decade. Debian Bug #791689 acknowledges this and questions why it hasn't been marked as conflicting with systemd.

        – JdeBP
        Nov 17 '15 at 9:41
















      124












      124








      124







      sysv-rc-conf



      Try using sysv-rc-conf



      sudo apt-get install sysv-rc-conf


      and to start managing the services, execute



      sudo sysv-rc-conf


      Which will bring up interactive window like this



      enter image description here



      You can further navigate through pages using Ctrl+n for next page and Ctrl+p for previous page. You can enable and disable services by selecting SPACE on desired runlevels.



      Jobs-Admin



      Another alternate would be Jobs-Admin by installing through



      sudo apt-get install jobs-admin


      Which also provides GUI like this



      jobs-admin preview



      For showing more jobs , you have to tick the Show Protected Jobs from its menu.



      chkconfig



      And third option would be chkconfig,



      sudo apt-get install chkconfig


      It can be used via CLI chkconfig, showing list of On/Off jobs.
      Also we can view system services using chkconfig –list



      Services can be turned on using



      chkconfig <service> on


      Services can be turned off using



      chkconfig <service> off


      And we can even add our own service, using a proper init script with proper headings.



      chkconfig --add <service>


      update-rc.d



      And another option can be referred here update-rc.d , explained briefly here.



      Note that for Ubuntu Server 12.04, update-rc.d is used instead of chkconfig.






      share|improve this answer















      sysv-rc-conf



      Try using sysv-rc-conf



      sudo apt-get install sysv-rc-conf


      and to start managing the services, execute



      sudo sysv-rc-conf


      Which will bring up interactive window like this



      enter image description here



      You can further navigate through pages using Ctrl+n for next page and Ctrl+p for previous page. You can enable and disable services by selecting SPACE on desired runlevels.



      Jobs-Admin



      Another alternate would be Jobs-Admin by installing through



      sudo apt-get install jobs-admin


      Which also provides GUI like this



      jobs-admin preview



      For showing more jobs , you have to tick the Show Protected Jobs from its menu.



      chkconfig



      And third option would be chkconfig,



      sudo apt-get install chkconfig


      It can be used via CLI chkconfig, showing list of On/Off jobs.
      Also we can view system services using chkconfig –list



      Services can be turned on using



      chkconfig <service> on


      Services can be turned off using



      chkconfig <service> off


      And we can even add our own service, using a proper init script with proper headings.



      chkconfig --add <service>


      update-rc.d



      And another option can be referred here update-rc.d , explained briefly here.



      Note that for Ubuntu Server 12.04, update-rc.d is used instead of chkconfig.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Apr 13 '17 at 12:24









      Community

      1




      1










      answered Jun 28 '12 at 18:00









      atenzatenz

      10.2k43559




      10.2k43559








      • 1





        on ubuntu server: Package chkconfig is not available, but is referred to by another package.

        – pwned
        Apr 22 '13 at 13:16











      • @pwned You are free to edit and post the updated info regarding server edition.Thank you.

        – atenz
        Apr 26 '13 at 14:53











      • I did as you have suggested, now it is up for peer review.

        – pwned
        Apr 26 '13 at 16:44











      • jobs-admin doesn't allow to change jobs (Ubuntu 14.04), producing a crash report instead ;-)

        – Sadi
        May 20 '14 at 14:38






      • 5





        sysv-rc-conf isn't suitable for use with upstart or systemd, it patently being only for the old System 5 rc system, which hasn't been the default on Ubuntu Linux for almost a decade. Debian Bug #791689 acknowledges this and questions why it hasn't been marked as conflicting with systemd.

        – JdeBP
        Nov 17 '15 at 9:41
















      • 1





        on ubuntu server: Package chkconfig is not available, but is referred to by another package.

        – pwned
        Apr 22 '13 at 13:16











      • @pwned You are free to edit and post the updated info regarding server edition.Thank you.

        – atenz
        Apr 26 '13 at 14:53











      • I did as you have suggested, now it is up for peer review.

        – pwned
        Apr 26 '13 at 16:44











      • jobs-admin doesn't allow to change jobs (Ubuntu 14.04), producing a crash report instead ;-)

        – Sadi
        May 20 '14 at 14:38






      • 5





        sysv-rc-conf isn't suitable for use with upstart or systemd, it patently being only for the old System 5 rc system, which hasn't been the default on Ubuntu Linux for almost a decade. Debian Bug #791689 acknowledges this and questions why it hasn't been marked as conflicting with systemd.

        – JdeBP
        Nov 17 '15 at 9:41










      1




      1





      on ubuntu server: Package chkconfig is not available, but is referred to by another package.

      – pwned
      Apr 22 '13 at 13:16





      on ubuntu server: Package chkconfig is not available, but is referred to by another package.

      – pwned
      Apr 22 '13 at 13:16













      @pwned You are free to edit and post the updated info regarding server edition.Thank you.

      – atenz
      Apr 26 '13 at 14:53





      @pwned You are free to edit and post the updated info regarding server edition.Thank you.

      – atenz
      Apr 26 '13 at 14:53













      I did as you have suggested, now it is up for peer review.

      – pwned
      Apr 26 '13 at 16:44





      I did as you have suggested, now it is up for peer review.

      – pwned
      Apr 26 '13 at 16:44













      jobs-admin doesn't allow to change jobs (Ubuntu 14.04), producing a crash report instead ;-)

      – Sadi
      May 20 '14 at 14:38





      jobs-admin doesn't allow to change jobs (Ubuntu 14.04), producing a crash report instead ;-)

      – Sadi
      May 20 '14 at 14:38




      5




      5





      sysv-rc-conf isn't suitable for use with upstart or systemd, it patently being only for the old System 5 rc system, which hasn't been the default on Ubuntu Linux for almost a decade. Debian Bug #791689 acknowledges this and questions why it hasn't been marked as conflicting with systemd.

      – JdeBP
      Nov 17 '15 at 9:41







      sysv-rc-conf isn't suitable for use with upstart or systemd, it patently being only for the old System 5 rc system, which hasn't been the default on Ubuntu Linux for almost a decade. Debian Bug #791689 acknowledges this and questions why it hasn't been marked as conflicting with systemd.

      – JdeBP
      Nov 17 '15 at 9:41













      48














      For those of us who run Ubuntu over ssh, I think the nicest option is rcconf - a text based program:



      sudo apt-get install rcconf
      sudo rcconf


      alt text



      Navigate with tab and arrow keys, press spacebar to enable/disable. Changes are persistent across restarts.



      Screenshot borrowed from this blogpost, which also shows sysv-rc-conf - a similar tool that also lets you set the runlevel. (For those who happen to care enough about runlevels to wish to change them :)



      Unfortunately, rcconf doesn't work with upstart (services listed in /etc/init/*), just with the traditional mechanism (ls -l /etc/init.d/* - the ones that are not symbolic links).



      Fortunately, many of the services that are relevant when ssh-ing in to a server (Apache, Tomcat, mdadm, boinc-client...) haven't been moved to upstart yet.






      share|improve this answer





















      • 6





        Does this still work with upstart?

        – oKtosiTe
        Jan 6 '11 at 20:18






      • 3





        Unfortunately, no. But it has worked for all the cases I have wanted to change - the upstart jobs seems to be mostly things I never want to disable - hardware clock, log daemon, network etc. (on Ubuntu server, at least). But it's something to be aware of (I wasn't :), I've updated the post.

        – j-g-faustus
        Jan 6 '11 at 20:59











      • Unfortunately mysql was converted to upstart. And thats a service i only use when im doing some project.

        – MestreLion
        May 27 '11 at 3:12











      • There's a bug with rcconf on Ubuntu 12.04 that prevents the program from starting. To solve the issue you need to install the dialog package.

        – devius
        Jun 2 '12 at 22:08






      • 1





        Since this answer was written, update-rc.d was changed, and some of its deprecated functionality was removed. Debian bug #727735 notes that rcconf was not changed to match. And no, rcconf does not work with systemd either, thus not being applicable to either of the default init systems for Ubuntu Linux for the past decade.

        – JdeBP
        Nov 17 '15 at 9:35
















      48














      For those of us who run Ubuntu over ssh, I think the nicest option is rcconf - a text based program:



      sudo apt-get install rcconf
      sudo rcconf


      alt text



      Navigate with tab and arrow keys, press spacebar to enable/disable. Changes are persistent across restarts.



      Screenshot borrowed from this blogpost, which also shows sysv-rc-conf - a similar tool that also lets you set the runlevel. (For those who happen to care enough about runlevels to wish to change them :)



      Unfortunately, rcconf doesn't work with upstart (services listed in /etc/init/*), just with the traditional mechanism (ls -l /etc/init.d/* - the ones that are not symbolic links).



      Fortunately, many of the services that are relevant when ssh-ing in to a server (Apache, Tomcat, mdadm, boinc-client...) haven't been moved to upstart yet.






      share|improve this answer





















      • 6





        Does this still work with upstart?

        – oKtosiTe
        Jan 6 '11 at 20:18






      • 3





        Unfortunately, no. But it has worked for all the cases I have wanted to change - the upstart jobs seems to be mostly things I never want to disable - hardware clock, log daemon, network etc. (on Ubuntu server, at least). But it's something to be aware of (I wasn't :), I've updated the post.

        – j-g-faustus
        Jan 6 '11 at 20:59











      • Unfortunately mysql was converted to upstart. And thats a service i only use when im doing some project.

        – MestreLion
        May 27 '11 at 3:12











      • There's a bug with rcconf on Ubuntu 12.04 that prevents the program from starting. To solve the issue you need to install the dialog package.

        – devius
        Jun 2 '12 at 22:08






      • 1





        Since this answer was written, update-rc.d was changed, and some of its deprecated functionality was removed. Debian bug #727735 notes that rcconf was not changed to match. And no, rcconf does not work with systemd either, thus not being applicable to either of the default init systems for Ubuntu Linux for the past decade.

        – JdeBP
        Nov 17 '15 at 9:35














      48












      48








      48







      For those of us who run Ubuntu over ssh, I think the nicest option is rcconf - a text based program:



      sudo apt-get install rcconf
      sudo rcconf


      alt text



      Navigate with tab and arrow keys, press spacebar to enable/disable. Changes are persistent across restarts.



      Screenshot borrowed from this blogpost, which also shows sysv-rc-conf - a similar tool that also lets you set the runlevel. (For those who happen to care enough about runlevels to wish to change them :)



      Unfortunately, rcconf doesn't work with upstart (services listed in /etc/init/*), just with the traditional mechanism (ls -l /etc/init.d/* - the ones that are not symbolic links).



      Fortunately, many of the services that are relevant when ssh-ing in to a server (Apache, Tomcat, mdadm, boinc-client...) haven't been moved to upstart yet.






      share|improve this answer















      For those of us who run Ubuntu over ssh, I think the nicest option is rcconf - a text based program:



      sudo apt-get install rcconf
      sudo rcconf


      alt text



      Navigate with tab and arrow keys, press spacebar to enable/disable. Changes are persistent across restarts.



      Screenshot borrowed from this blogpost, which also shows sysv-rc-conf - a similar tool that also lets you set the runlevel. (For those who happen to care enough about runlevels to wish to change them :)



      Unfortunately, rcconf doesn't work with upstart (services listed in /etc/init/*), just with the traditional mechanism (ls -l /etc/init.d/* - the ones that are not symbolic links).



      Fortunately, many of the services that are relevant when ssh-ing in to a server (Apache, Tomcat, mdadm, boinc-client...) haven't been moved to upstart yet.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Aug 1 '14 at 21:25









      Community

      1




      1










      answered Jan 6 '11 at 18:44









      j-g-faustusj-g-faustus

      4,15763045




      4,15763045








      • 6





        Does this still work with upstart?

        – oKtosiTe
        Jan 6 '11 at 20:18






      • 3





        Unfortunately, no. But it has worked for all the cases I have wanted to change - the upstart jobs seems to be mostly things I never want to disable - hardware clock, log daemon, network etc. (on Ubuntu server, at least). But it's something to be aware of (I wasn't :), I've updated the post.

        – j-g-faustus
        Jan 6 '11 at 20:59











      • Unfortunately mysql was converted to upstart. And thats a service i only use when im doing some project.

        – MestreLion
        May 27 '11 at 3:12











      • There's a bug with rcconf on Ubuntu 12.04 that prevents the program from starting. To solve the issue you need to install the dialog package.

        – devius
        Jun 2 '12 at 22:08






      • 1





        Since this answer was written, update-rc.d was changed, and some of its deprecated functionality was removed. Debian bug #727735 notes that rcconf was not changed to match. And no, rcconf does not work with systemd either, thus not being applicable to either of the default init systems for Ubuntu Linux for the past decade.

        – JdeBP
        Nov 17 '15 at 9:35














      • 6





        Does this still work with upstart?

        – oKtosiTe
        Jan 6 '11 at 20:18






      • 3





        Unfortunately, no. But it has worked for all the cases I have wanted to change - the upstart jobs seems to be mostly things I never want to disable - hardware clock, log daemon, network etc. (on Ubuntu server, at least). But it's something to be aware of (I wasn't :), I've updated the post.

        – j-g-faustus
        Jan 6 '11 at 20:59











      • Unfortunately mysql was converted to upstart. And thats a service i only use when im doing some project.

        – MestreLion
        May 27 '11 at 3:12











      • There's a bug with rcconf on Ubuntu 12.04 that prevents the program from starting. To solve the issue you need to install the dialog package.

        – devius
        Jun 2 '12 at 22:08






      • 1





        Since this answer was written, update-rc.d was changed, and some of its deprecated functionality was removed. Debian bug #727735 notes that rcconf was not changed to match. And no, rcconf does not work with systemd either, thus not being applicable to either of the default init systems for Ubuntu Linux for the past decade.

        – JdeBP
        Nov 17 '15 at 9:35








      6




      6





      Does this still work with upstart?

      – oKtosiTe
      Jan 6 '11 at 20:18





      Does this still work with upstart?

      – oKtosiTe
      Jan 6 '11 at 20:18




      3




      3





      Unfortunately, no. But it has worked for all the cases I have wanted to change - the upstart jobs seems to be mostly things I never want to disable - hardware clock, log daemon, network etc. (on Ubuntu server, at least). But it's something to be aware of (I wasn't :), I've updated the post.

      – j-g-faustus
      Jan 6 '11 at 20:59





      Unfortunately, no. But it has worked for all the cases I have wanted to change - the upstart jobs seems to be mostly things I never want to disable - hardware clock, log daemon, network etc. (on Ubuntu server, at least). But it's something to be aware of (I wasn't :), I've updated the post.

      – j-g-faustus
      Jan 6 '11 at 20:59













      Unfortunately mysql was converted to upstart. And thats a service i only use when im doing some project.

      – MestreLion
      May 27 '11 at 3:12





      Unfortunately mysql was converted to upstart. And thats a service i only use when im doing some project.

      – MestreLion
      May 27 '11 at 3:12













      There's a bug with rcconf on Ubuntu 12.04 that prevents the program from starting. To solve the issue you need to install the dialog package.

      – devius
      Jun 2 '12 at 22:08





      There's a bug with rcconf on Ubuntu 12.04 that prevents the program from starting. To solve the issue you need to install the dialog package.

      – devius
      Jun 2 '12 at 22:08




      1




      1





      Since this answer was written, update-rc.d was changed, and some of its deprecated functionality was removed. Debian bug #727735 notes that rcconf was not changed to match. And no, rcconf does not work with systemd either, thus not being applicable to either of the default init systems for Ubuntu Linux for the past decade.

      – JdeBP
      Nov 17 '15 at 9:35





      Since this answer was written, update-rc.d was changed, and some of its deprecated functionality was removed. Debian bug #727735 notes that rcconf was not changed to match. And no, rcconf does not work with systemd either, thus not being applicable to either of the default init systems for Ubuntu Linux for the past decade.

      – JdeBP
      Nov 17 '15 at 9:35











      18














      I found out that there is this GUI tool, something like BUM but compatible with Upstart:





      • Jobs-Admin



        sudo apt-get install jobs-admin







      share|improve this answer


























      • But it is too simple, and do not allow to change "protected jobs" ( what is that jobbs? Apple has Jobs, operating system has daemons!)

        – kakaz
        Dec 19 '13 at 20:06











      • I doesn't even allow to change "unprotected jobs" (Ubuntu 14.04), producing a crash report instead ;-)

        – Sadi
        May 20 '14 at 14:37
















      18














      I found out that there is this GUI tool, something like BUM but compatible with Upstart:





      • Jobs-Admin



        sudo apt-get install jobs-admin







      share|improve this answer


























      • But it is too simple, and do not allow to change "protected jobs" ( what is that jobbs? Apple has Jobs, operating system has daemons!)

        – kakaz
        Dec 19 '13 at 20:06











      • I doesn't even allow to change "unprotected jobs" (Ubuntu 14.04), producing a crash report instead ;-)

        – Sadi
        May 20 '14 at 14:37














      18












      18








      18







      I found out that there is this GUI tool, something like BUM but compatible with Upstart:





      • Jobs-Admin



        sudo apt-get install jobs-admin







      share|improve this answer















      I found out that there is this GUI tool, something like BUM but compatible with Upstart:





      • Jobs-Admin



        sudo apt-get install jobs-admin








      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jun 28 '12 at 16:18









      Jorge Castro

      36.2k105422617




      36.2k105422617










      answered May 21 '12 at 10:27









      PostadelmagaPostadelmaga

      4,30832037




      4,30832037













      • But it is too simple, and do not allow to change "protected jobs" ( what is that jobbs? Apple has Jobs, operating system has daemons!)

        – kakaz
        Dec 19 '13 at 20:06











      • I doesn't even allow to change "unprotected jobs" (Ubuntu 14.04), producing a crash report instead ;-)

        – Sadi
        May 20 '14 at 14:37



















      • But it is too simple, and do not allow to change "protected jobs" ( what is that jobbs? Apple has Jobs, operating system has daemons!)

        – kakaz
        Dec 19 '13 at 20:06











      • I doesn't even allow to change "unprotected jobs" (Ubuntu 14.04), producing a crash report instead ;-)

        – Sadi
        May 20 '14 at 14:37

















      But it is too simple, and do not allow to change "protected jobs" ( what is that jobbs? Apple has Jobs, operating system has daemons!)

      – kakaz
      Dec 19 '13 at 20:06





      But it is too simple, and do not allow to change "protected jobs" ( what is that jobbs? Apple has Jobs, operating system has daemons!)

      – kakaz
      Dec 19 '13 at 20:06













      I doesn't even allow to change "unprotected jobs" (Ubuntu 14.04), producing a crash report instead ;-)

      – Sadi
      May 20 '14 at 14:37





      I doesn't even allow to change "unprotected jobs" (Ubuntu 14.04), producing a crash report instead ;-)

      – Sadi
      May 20 '14 at 14:37











      12














      Editing the existing upstart configuration file (as described above) is not such a good idea. An updated package could provide an updated config, and you'd had to repeat your changes over and over.



      By taking a look at man 5 init one will find a more appropriate solution: using an override config. Short example: Say we have a service called "foobar", so there would be a file called /etc/init/foobar.conf with its upstart configuration. Now you don't want to remove that file, nor to modify it -- but neither you want this service to run? So place an override file next to it: /etc/init/foobar.override, containing (optionally the header with the description and) instead the start on / stop on lines you place a line with one word: manual. This way you tell upstart to basically use the foobar.conf, but override the startup definition to only start that service when manually enforced (via service foobar start in our example).






      share|improve this answer




























        12














        Editing the existing upstart configuration file (as described above) is not such a good idea. An updated package could provide an updated config, and you'd had to repeat your changes over and over.



        By taking a look at man 5 init one will find a more appropriate solution: using an override config. Short example: Say we have a service called "foobar", so there would be a file called /etc/init/foobar.conf with its upstart configuration. Now you don't want to remove that file, nor to modify it -- but neither you want this service to run? So place an override file next to it: /etc/init/foobar.override, containing (optionally the header with the description and) instead the start on / stop on lines you place a line with one word: manual. This way you tell upstart to basically use the foobar.conf, but override the startup definition to only start that service when manually enforced (via service foobar start in our example).






        share|improve this answer


























          12












          12








          12







          Editing the existing upstart configuration file (as described above) is not such a good idea. An updated package could provide an updated config, and you'd had to repeat your changes over and over.



          By taking a look at man 5 init one will find a more appropriate solution: using an override config. Short example: Say we have a service called "foobar", so there would be a file called /etc/init/foobar.conf with its upstart configuration. Now you don't want to remove that file, nor to modify it -- but neither you want this service to run? So place an override file next to it: /etc/init/foobar.override, containing (optionally the header with the description and) instead the start on / stop on lines you place a line with one word: manual. This way you tell upstart to basically use the foobar.conf, but override the startup definition to only start that service when manually enforced (via service foobar start in our example).






          share|improve this answer













          Editing the existing upstart configuration file (as described above) is not such a good idea. An updated package could provide an updated config, and you'd had to repeat your changes over and over.



          By taking a look at man 5 init one will find a more appropriate solution: using an override config. Short example: Say we have a service called "foobar", so there would be a file called /etc/init/foobar.conf with its upstart configuration. Now you don't want to remove that file, nor to modify it -- but neither you want this service to run? So place an override file next to it: /etc/init/foobar.override, containing (optionally the header with the description and) instead the start on / stop on lines you place a line with one word: manual. This way you tell upstart to basically use the foobar.conf, but override the startup definition to only start that service when manually enforced (via service foobar start in our example).







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jun 30 '12 at 20:27









          IzzyIzzy

          2,81241846




          2,81241846























              8














              There is also the Boot-Up Manager.



              To install: sudo apt-get install bum



              Further info: http://www.marzocca.net/linux/bum.html



              enter image description here






              share|improve this answer



















              • 1





                Dont forget to check the "Advanced" button.

                – not2qubit
                Feb 4 '16 at 2:10
















              8














              There is also the Boot-Up Manager.



              To install: sudo apt-get install bum



              Further info: http://www.marzocca.net/linux/bum.html



              enter image description here






              share|improve this answer



















              • 1





                Dont forget to check the "Advanced" button.

                – not2qubit
                Feb 4 '16 at 2:10














              8












              8








              8







              There is also the Boot-Up Manager.



              To install: sudo apt-get install bum



              Further info: http://www.marzocca.net/linux/bum.html



              enter image description here






              share|improve this answer













              There is also the Boot-Up Manager.



              To install: sudo apt-get install bum



              Further info: http://www.marzocca.net/linux/bum.html



              enter image description here







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered May 20 '14 at 14:47









              SadiSadi

              8,77543848




              8,77543848








              • 1





                Dont forget to check the "Advanced" button.

                – not2qubit
                Feb 4 '16 at 2:10














              • 1





                Dont forget to check the "Advanced" button.

                – not2qubit
                Feb 4 '16 at 2:10








              1




              1





              Dont forget to check the "Advanced" button.

              – not2qubit
              Feb 4 '16 at 2:10





              Dont forget to check the "Advanced" button.

              – not2qubit
              Feb 4 '16 at 2:10











              0














              I use Stacer.
              It shows services and processes also. A complete GUI system toolbox.
              https://github.com/oguzhaninan/Stacer






              share|improve this answer




























                0














                I use Stacer.
                It shows services and processes also. A complete GUI system toolbox.
                https://github.com/oguzhaninan/Stacer






                share|improve this answer


























                  0












                  0








                  0







                  I use Stacer.
                  It shows services and processes also. A complete GUI system toolbox.
                  https://github.com/oguzhaninan/Stacer






                  share|improve this answer













                  I use Stacer.
                  It shows services and processes also. A complete GUI system toolbox.
                  https://github.com/oguzhaninan/Stacer







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 8 at 7:36









                  HDK BoumaHDK Bouma

                  265




                  265















                      Popular posts from this blog

                      flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                      Mangá

                       ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕