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.
- 10-05-2012 #1Just Joined!
- Join Date
- Oct 2012
- Posts
- 1
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.
- 10-06-2012 #2Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,685
You can use the chkconfig utility for this, e.g.:
will list all the runlevels on your system and whether httpd is enable or disable in each runlevel.Code:chkconfig --list httpd
to know your default runlevel (when the system boots up), do this:
it is likely 3 (network, multi-user, text mode) or 5 (network, multi-user, graphic mode)Code:awk -F: '$1 ~ /id/{print $2}' /etc/inittab
to get your current runlevel (in case it was changed after boot up):
it will list the previous runlevel in the first column and the current runlevel in the 2nd column.Code:runlevel
you can enable a command like this:
that will enable the httpd command in levels 3 and 5.Code:chkconfig --level 35 httpd on
to check a commands default runlevels, look at the chkconfig line in the script in /etc/init.d, e.g.:
for more details:Code:grep chkconfig /etc/init.d/httpd
Code:man chkconfig
- 10-06-2012 #3Just Joined!
- Join Date
- Sep 2005
- Location
- Edmonton, Canada
- Posts
- 43
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.
- 10-08-2012 #4Linux Newbie
- Join Date
- Nov 2009
- Posts
- 117
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.
- 10-08-2012 #5Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,685
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.


Reply With Quote

