Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

One thing that always confused me in Ubuntu was how system services are started. I know that Ubuntu uses Upstart and supports SysV, but which one is used to start the services? This matters when you want a "manual" start for a service.

For example, on my system i have files for the following services either in /etc/init.d/<service> (SysV) and /etc/init/<service>.conf (Upstart):

acpid, mysql, networking, qemu-kvm, ufw, libvirt-bin

So if i want to disable MySQL execution at startup, i must use the Upstart way or the SysV way to disable it? Also, how can i tell which of those is really used to start a generic service?

Edit

The really doubt here is not how disable/enable services using SysV/Upstart. What really confuses me is that some services seem to be defined (and enabled) in SysV and Upstart at the same time. Is there any precedence between them (like if mysql is enabled in both launch it using SysV)? Or can it be the case that one tool uses the other in background?

share|improve this question
1  
Have a look at the accepted answer here: askubuntu.com/questions/133807/… has some interesting links. –  Rinzwind Dec 2 '12 at 0:35
    
Awesome question I think... –  djangofan Dec 5 '12 at 2:48
add comment

2 Answers

up vote 2 down vote accepted
+50

Regarding services that are defined in both SysV and upstart, generally if you restart it through SysV you'll see something like this:

al@al-mythtv:~$ sudo /etc/init.d/mysql restart
[sudo] password for al: 
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop mysql ; start mysql. The restart(8) utility is also available.
mysql stop/waiting
mysql start/running, process 29846

What I take this to mean is that Upstart is preferred for these services, and the SysV implementation is just a wrapper.

Also, I think you have the meaning of the directories backwards. /etc/init is upstart configuration, /etc/init.d is the SysV compatibility, but it is just symlinks to upstart for these type of services.

share|improve this answer
add comment

It does largely depend on the application and its packaging maintainer.

There is a strong preference for Upstart scripts because they handle events (which is generally a great thing) but a lot of applications don't have good enough Upstart scripts available or the application's maintainer has chosen to stick with the defaults (application or Debian's).

Either way, you're in the position where you have to adapt.

  • For Upstart:
    • Rename the file to something that doesn't end .conf, or
    • Add manual to the file. This will allow you to manually load the service.
  • For older services:

    update-rc.d -f <service> remove
    

If you have an /etc/init.d/ script for something and an /etc/init/ script and you want to check if the init.d version is still live, you can check with:

ls -l /etc/rc?.d/*<service>

If you see a load of symlinks, it's installed in the old SysV init.

share|improve this answer
    
So if i have a service which is enabled in SysV and Upstart (for example, acpid), i can assume it is launched by SysV? Or if i want to disable it i would need to do it using update-rc.d and the rename trick? –  Salem Dec 2 '12 at 12:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.