Red Hat This forum is for the discussion of Red Hat Linux. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-24-2006, 07:31 AM
|
#1
|
Member
Registered: Jul 2004
Location: india
Distribution: Ubuntu 14.04
Posts: 155
Rep:
|
service status
hi guys,
for some it might be nothing but for some it is mystey!!
i want to know whether we can know the status of any service through filesystem i.e, without using any commands. if so how??
it would be great if any one explans me how to step wise.
thnx in advance
|
|
|
03-24-2006, 08:18 AM
|
#2
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
well firstly a "service" can take many many forms and as such there is no generic way to check it, as you can't be sure what each service actually comprises of. in general though, you'd check a service to see if a certain process is running. you would normally do this via ps, if you are not using a certain pid file within the service script, and so you could theoretically search /proc/ for pid files whose command line file, e.g. /proc/1234/cmdline contains the right program name.
also there is /var/lock/subsys, which *SOME* serviecs use to register the fact that they are up. That would simpler if the service uses it, but it is not as reliable as lock files get left in place etc...
|
|
|
03-27-2006, 02:12 AM
|
#3
|
Member
Registered: Jul 2004
Location: india
Distribution: Ubuntu 14.04
Posts: 155
Original Poster
Rep:
|
hey that's really good info. but there wasn't any directory named 1234 but there are many directories name 1216,1434,etc... and in each directory there is a filename cmdline(as u said) and there is name of the service running. i would like to know why the folder 1234 is not there in my sys( i am using rh9). is there any file which lists all the running services in one file(of course other than /var/lock/subsys)??
|
|
|
04-01-2006, 06:55 AM
|
#4
|
LQ Newbie
Registered: Mar 2005
Distribution: RHEL4, Knoppix, DSL, Suse, Debian
Posts: 16
Rep:
|
Well, like acid_kewpie said, running the ps -ef |grep httpd for example will show you if the web server service is running, ps -ef | grep vsftpd will show if vsftp is running etc etc...
to see which services are configured to start in various runlevels, you can run:
chkconfig --list
That will give you the list of installed services and what runlevel they are configured to run in noted by ON or OFF in the list.
if for example you wanted vsftp to start at boot up in runlevel 5 (graphic mode) you would run:
chkconfig --level 5 vsftpd on
or to start it at boot up in levels 3,4, and 5 simply
chkconfig vsftpd on
Some (NOT All) services will also report their status (running or stopped) using:
service servicename status
for example, running the command:
service httpd status
returns the output:
httpd is stopped
Hope this helps!
Last edited by -=RkR=-; 04-01-2006 at 07:26 AM.
|
|
|
04-01-2006, 08:30 AM
|
#5
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
why on earth would something think that "1234" was meant to be literal?? 
|
|
|
04-01-2006, 12:54 PM
|
#6
|
LQ Newbie
Registered: Mar 2005
Distribution: RHEL4, Knoppix, DSL, Suse, Debian
Posts: 16
Rep:
|
Quote:
Originally Posted by acid_kewpie
why on earth would something think that "1234" was meant to be literal?? 
|
What, you mean that everyone doesn't have a PID 1234?

|
|
|
04-03-2006, 05:29 AM
|
#7
|
Member
Registered: Jul 2004
Location: india
Distribution: Ubuntu 14.04
Posts: 155
Original Poster
Rep:
|
sorry since there were directories in that form, i thought there would be a directory 1234. that's all. anyway rkr just go on and plz read the quiestion i have asked and then reply plz. i am also an rhce i know how to start a service and enable a service at different levels and when acid_kewpie was mentioning 1234 he was'nt mentioning abt pid's.
thnx acid_kewpie once again.
|
|
|
All times are GMT -5. The time now is 02:59 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|