Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
ok my distro is Debian Lenny As I install/configure/troubleshoot/test new packages have a need for frequently stopping and starting services as I test various configurations. OK I have seen a ...
  1. #1
    Just Joined! fguy64's Avatar
    Join Date
    Aug 2009
    Posts
    87

    Various methods for restarting services

    ok my distro is Debian Lenny

    As I install/configure/troubleshoot/test new packages have a need for frequently stopping and starting services as I test various configurations. OK I have seen a few options. I'm interested to hear what people prefer for this sort of thing.

    one thing that is not perfectly clear is how to be sure in advance whether a particular application or service needs a restart after a config change. And it's not clear whether there is a consistent strategy that always works. Are there any services which require a reboot?

    Here are a few options I have looked at...

    1. source /etc/init.d/<startup script name> to manually invoke the startup script, which appears to both start a service if it is stopped and start a service if it is started.
    2. /etc/init.d/rc is a script, a tool which can be used to start/stop services haven't looked into this too much. I see it is already on my machine.
    3. a package called sysvconfig which can be downloaded looks pretty slick


    so how do you like to deal with this?


    edit: as I look into this further, I'm not so sure that the source command is supposed to be used to execute a startup script manually, it's not clear.

  2. #2
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Location
    Boston, MA
    Posts
    4,651
    I've always just used /etc/init.d/service [start|stop|restart] for Debian and derivative distros.

    one thing that is not perfectly clear is how to be sure in advance whether a particular application or service needs a restart after a config change. And it's not clear whether there is a consistent strategy that always works. Are there any services which require a reboot?
    I think it's pretty safe to assume if you change configuration options, the service has to be restarted for the change to take effect.

  3. #3
    Just Joined! fguy64's Avatar
    Join Date
    Aug 2009
    Posts
    87
    Quote Originally Posted by reed9 View Post
    I've always just used /etc/init.d/service [start|stop|restart] for Debian and derivative distros.

    ,,,

    I think it's pretty safe to assume if you change configuration options, the service has to be restarted for the change to take effect.
    right, thanks. /etc/init.d/service looked appealing to me to. Research tells me it is part of the sysvconfig package which I don't have on my bare bones install yet. perhaps I will download it. It looks like a good way to do things.


    Ubuntu / Debian Linux: Services Configuration Tool to Start / Stop System Services

  4. #4
    Linux Enthusiast Bemk's Avatar
    Join Date
    Sep 2008
    Location
    Oosterhout-NB, Netherlands
    Posts
    522
    I use Ubuntu, but also use the reboot scripts from /etc/init.d/.

  5. #5
    Just Joined! fguy64's Avatar
    Join Date
    Aug 2009
    Posts
    87
    Quote Originally Posted by Bemk View Post
    I use Ubuntu, but also use the reboot scripts from /etc/init.d/.
    Can't say for sure, but I would expect that this sort of thing is pretty similar between Debian and Ubuntu. As I understood, most if not all services that one might need to restart had startup scripts that could be executed along with Start/Stop/Restart command line switches.

    One thing that I couldn't nail down was whether all the scripts worked pretty much the same way as I described above, or just what it was that the service command from sysvconfig package provided as "value added" as compared to using the scripts directly like you describe.

  6. #6
    Linux Enthusiast Bemk's Avatar
    Join Date
    Sep 2008
    Location
    Oosterhout-NB, Netherlands
    Posts
    522
    As far as I know these scripts are called when the system starts and shuts down. In the first case with the start option and in the latter with the stop option.

    I don't know how they work, as I have not yet emerged my self in the world of those scripts.

  7. #7
    Just Joined! fguy64's Avatar
    Join Date
    Aug 2009
    Posts
    87
    OK, continuing on with managing services. I have stop/start/restart nailed down pretty good, now looking at enable, disable. So there is two or three ways of dealing with that.

    I looked, but I do not see a single overriding flat text file script, whereby one can comment out calls to the startup scripts of the various services. debconf.conf didn't meet the bill. The debian policy manual mentions the following...

    The /etc/init.d directory contains the scripts executed by init at boot time. Now the only init I could find is /sbin/init which is not a flat text script.


    ok that leaves two options...

    apparently one can rename the symbolic links to the startup scripts in /etc/rc<n>.d, but I got the impression that was not always reliable, that sometimes the links couold be recreated?

    So it looks like sysvconfig is the way to go for disabling services.

  8. #8
    Linux Enthusiast Bemk's Avatar
    Join Date
    Sep 2008
    Location
    Oosterhout-NB, Netherlands
    Posts
    522
    Init is one of the very first threads taking over control untill the system has been sufficiently bootstrapped to hand over control to the user.

    I think Ubuntu uses startup instead of Init, but I could be wrong.

  9. #9
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Location
    Boston, MA
    Posts
    4,651
    I've never used it, but there is sysv-rc-conf

    Alternative for chkconfig in Ubuntu - sysv-rc-conf - enable or disable services at startup

    The default tool for Debian/Ubuntu, I believe is, update-rc.d

    Code:
    sudo update-rc.d -f <service> remove
    All of this makes me appreciate Arch. Specifying services, modules, and network configuration all happen in one file, /etc/rc.conf, and services don't run by default, you have to list them in the daemons array.

  10. #10
    Just Joined! fguy64's Avatar
    Join Date
    Aug 2009
    Posts
    87
    Quote Originally Posted by Bemk View Post
    Init is one of the very first threads taking over control untill the system has been sufficiently bootstrapped to hand over control to the user.

    I think Ubuntu uses startup instead of Init, but I could be wrong.
    OK thanks it makes sense. Point is, it can't be edited manually as far as I can see. If anyone knows of an overriding editable script that calls the startup scripts of services and daemons, I'm all ears. So far it seems there isn't one, and we must use some kind of utility like sysvconfig, but i'm not certain.

Page 1 of 2 1 2 LastLast

Posting Permissions

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