Find the answer to your Linux question:
Results 1 to 5 of 5
Hi All! I'm trying to find out how to check the startup type of the services in RedHat. i want to know whether the service it's set to automatic start ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2012
    Posts
    1

    Question Service stertup type


    Hi All!

    I'm trying to find out how to check the startup type of the services in RedHat.
    i want to know whether the service it's set to automatic start if it stops etc.
    Can anyone help me out here please?

    Edit:
    I mean not startup on boot of the system but when the service is stopped whether it will start automatically.
    Last edited by subtle; 10-05-2012 at 07:28 AM.

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Quote Originally Posted by subtle View Post
    Hi All!

    I'm trying to find out how to check the startup type of the services in RedHat.
    i want to know whether the service it's set to automatic start if it stops etc.
    Can anyone help me out here please?

    Edit:
    I mean not startup on boot of the system but when the service is stopped whether it will start automatically.
    You can use the chkconfig utility for this, e.g.:

    Code:
    chkconfig --list httpd
    will list all the runlevels on your system and whether httpd is enable or disable in each runlevel.

    to know your default runlevel (when the system boots up), do this:

    Code:
    awk -F:  '$1 ~ /id/{print $2}' /etc/inittab
    it is likely 3 (network, multi-user, text mode) or 5 (network, multi-user, graphic mode)

    to get your current runlevel (in case it was changed after boot up):

    Code:
    runlevel
    it will list the previous runlevel in the first column and the current runlevel in the 2nd column.

    you can enable a command like this:

    Code:
    chkconfig --level 35 httpd on
    that will enable the httpd command in levels 3 and 5.

    to check a commands default runlevels, look at the chkconfig line in the script in /etc/init.d, e.g.:

    Code:
    grep chkconfig /etc/init.d/httpd
    for more details:

    Code:
    man chkconfig

  3. #3
    Just Joined!
    Join Date
    Sep 2005
    Location
    Edmonton, Canada
    Posts
    48
    I believe the question is "How can someone tell if a service is to set to automatically restart if it stops?"
    I believe the answer is to find out why the service is stopping in the first place.
    Linux doesn't have a generic way to check if a service has stopped and, in that event, restart it. This is because a properly programmed and configured service doesn't stop, unless told to, under Linux. Services, by definition, run until the system is rebooted or shutdown, or the service is stopped by a user.
    If any service is stopping without being told to, then there is likely a problem with either the service's programs, its libraires, or its configuration.

    For those few problem services that stop unexpectedly, you can look for 3rd party solutions for that particular service, or you can write a custom script, or program, that can be run from 'cron', to check if the service is running, and if it isn't, restart it.

  4. #4
    Linux Newbie
    Join Date
    Nov 2009
    Posts
    223
    Well... not exactly.

    If you use init to start the service, you can specify to it (initd) what to do if the prog goes away. This includes the "respawn" option to have initd automatically restart a process that dies. initd will monitor how quickly the proc dies and will hold off restarting for a while if the proc is dying repeatedly within a short period of time.

  5. #5
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Quote Originally Posted by voidpointer69 View Post
    Well... not exactly.

    If you use init to start the service, you can specify to it (initd) what to do if the prog goes away. This includes the "respawn" option to have initd automatically restart a process that dies. initd will monitor how quickly the proc dies and will hold off restarting for a while if the proc is dying repeatedly within a short period of time.
    FYI, if you are on a newer system that does not use init/inittab in favor of the shiny new systemd (Fedora 15 and later, Frugalware 1.5 and later, Mageia 2, Mandriva 2011, and openSUSE 12.1 and later), or you've made it the default on your system, it supports that functionality as well:

    https://fedoraproject.org/wiki/User:...ervice#Options

    Search for Restart= under the Options sub-heading.

Posting Permissions

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