Results 1 to 9 of 9

Thread: Remove Service Controlled by Upstart From Boot in 10.04

  1. #1
    Join Date
    Apr 2006
    Beans
    10

    Remove Service Controlled by Upstart From Boot in 10.04

    How do I go about preventing a service that is controlled by Upstart from starting when the machine is booted. I'm trying to prevent Mysql from starting on boot and in Lucid it's controlled by Upstart which means I can no longer use update-rc.d to remove it from the boot. I've read elsewhere to rename the /etc/init/mysql.conf file to mysql.conf-disabled, but renaming the file makes the "service mysql start" command stop working because Upstart uses that file if I want to manually start the service.

  2. #2
    Join Date
    Apr 2006
    Beans
    10

    Re: Remove Service Controlled by Upstart From Boot in 10.04

    Bump.

  3. #3
    Join Date
    Aug 2009
    Location
    West Sussex, England
    Beans
    117
    Distro
    Ubuntu

    Re: Remove Service Controlled by Upstart From Boot in 10.04

    I have recently been stumped by this too, so your question finally made me sit down and look into upstart.

    Most solutions I have found won't work properly, because they suggest making changes that will cause the service to fail to start.
    This is not what you want because you still want the service to start when called manually.


    I have come to the conclusion that you can't use upstart like sysvinit. You have to think event based.


    So what you want to do is cause MySQL to not try to start on any change to run level, or specifically run level 2, which is the run level Ubuntu runs in (by default although apart from 0 and 6 they all now appear to be the same).

    The configuration (what used to be called an init script) is now /etc/init/mysql.conf and not /etc/init.d/mysql

    The bit that starts the service is
    Code:
    start on (net-device-up
              and local-filesystems)
    In other words, when the network devices start and the disks are mounted, start MySQL.
    Okay, so that is always.

    You need to comment out those lines, otherwise MySQL will always start on boot.

    However you do still need a "start on" section so use this instead:

    start on runlevel [!0123456]

    That is ( in words), start MySQL when the run level is not 0,1,2,3,4,5 or 6.
    Okay so that is never.

    You now are in the situation when MySQL will never start automatically by upstart, and you have not had to rename any configurations or in any other way break MySQL as a service and you can still start MySQL manually using

    Code:
    service mysql start
    The documentation on this is scarce, so any feedback would be appreciated.

    Thanks to : http://old.nabble.com/Start-stop-ser...d26272954.html
    Richard Holloway
    PHP Developer and System Administrator
    http://richardjh.org

  4. #4
    Join Date
    Apr 2006
    Beans
    10

    Re: Remove Service Controlled by Upstart From Boot in 10.04

    Quote Originally Posted by richardjh View Post
    I have recently been stumped by this too, so your question finally made me sit down and look into upstart.

    Most solutions I have found won't work properly, because they suggest making changes that will cause the service to fail to start.
    This is not what you want because you still want the service to start when called manually.


    I have come to the conclusion that you can't use upstart like sysvinit. You have to think event based.


    So what you want to do is cause MySQL to not try to start on any change to run level, or specifically run level 2, which is the run level Ubuntu runs in (by default although apart from 0 and 6 they all now appear to be the same).

    The configuration (what used to be called an init script) is now /etc/init/mysql.conf and not /etc/init.d/mysql

    The bit that starts the service is
    Code:
    start on (net-device-up
              and local-filesystems)
    In other words, when the network devices start and the disks are mounted, start MySQL.
    Okay, so that is always.

    You need to comment out those lines, otherwise MySQL will always start on boot.

    However you do still need a "start on" section so use this instead:

    start on runlevel [!0123456]

    That is ( in words), start MySQL when the run level is not 0,1,2,3,4,5 or 6.
    Okay so that is never.

    You now are in the situation when MySQL will never start automatically by upstart, and you have not had to rename any configurations or in any other way break MySQL as a service and you can still start MySQL manually using

    Code:
    service mysql start
    The documentation on this is scarce, so any feedback would be appreciated.

    Thanks to : http://old.nabble.com/Start-stop-ser...d26272954.html
    I changed the start on line in /etc/init/mysql.conf to

    start on runlevel [!0123456]

    like you suggested and it worked great. Thanks for your help.

  5. #5
    Join Date
    Jun 2005
    Beans
    212

    Smile Re: Remove Service Controlled by Upstart From Boot in 10.04

    Richards suggestion solved my problem as well: I often need an FTP server (vsftpd), but for security reasons I dislike having it running all the time (upstart).
    I think this suggestion should make it into a HowTo, sticky post etc. because I guess many people have this problem.
    thanks !

  6. #6
    Join Date
    Jul 2007
    Beans
    13

    Re: Remove Service Controlled by Upstart From Boot in 10.04

    "man 5 init" says you can create /etc/init/mysql.override to over-ride mysql.conf, so you don't have to edit mysql.conf at all.

  7. #7
    Join Date
    Nov 2006
    Location
    Belgium
    Beans
    3,025
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Remove Service Controlled by Upstart From Boot in 10.04

    AFAIK, you can also rename de .conf filies in /etc/init, eg to something like /etc/init/mysql.conf.DISABLED to prevent upstart (init) from seeing/processing them

  8. #8
    Join Date
    Dec 2012
    Location
    Canada
    Beans
    187
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Remove Service Controlled by Upstart From Boot in 10.04

    Quote Originally Posted by koenn View Post
    AFAIK, you can also rename de .conf filies in /etc/init, eg to something like /etc/init/mysql.conf.DISABLED to prevent upstart (init) from seeing/processing them
    Yes, but the OP said they didn't like that approach because it also breaks

    Code:
    service mysql start
    idallen's suggestion of creating a 'mysql.override' file does seem to work, however. I just did...

    Code:
    cp /etc/init/mysql.conf /etc/init/mysql.override
    ...and then changed the line in 'mysql.override' from...

    Code:
    start on runlevel [2345]
    ...to...

    Code:
    start on runlevel [!0123456]
    MySQL does not start on boot, but it can still be started manually with `service mysql start`.

  9. #9
    Join Date
    Nov 2006
    Location
    Belgium
    Beans
    3,025
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Remove Service Controlled by Upstart From Boot in 10.04

    good to know.

    I also just noticed this thread is over two years old

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •