LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 03-24-2006, 06:31 AM   #1
gsr_kashyap
Member
 
Registered: Jul 2004
Location: india
Distribution: Ubuntu 14.04
Posts: 155

Rep: Reputation: 15
Question 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
 
Old 03-24-2006, 07:18 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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...
 
Old 03-27-2006, 01:12 AM   #3
gsr_kashyap
Member
 
Registered: Jul 2004
Location: india
Distribution: Ubuntu 14.04
Posts: 155

Original Poster
Rep: Reputation: 15
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)??
 
Old 04-01-2006, 05:55 AM   #4
-=RkR=-
LQ Newbie
 
Registered: Mar 2005
Distribution: RHEL4, Knoppix, DSL, Suse, Debian
Posts: 16

Rep: Reputation: 0
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 06:26 AM.
 
Old 04-01-2006, 07:30 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
why on earth would something think that "1234" was meant to be literal??
 
Old 04-01-2006, 11:54 AM   #6
-=RkR=-
LQ Newbie
 
Registered: Mar 2005
Distribution: RHEL4, Knoppix, DSL, Suse, Debian
Posts: 16

Rep: Reputation: 0
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?
 
Old 04-03-2006, 04:29 AM   #7
gsr_kashyap
Member
 
Registered: Jul 2004
Location: india
Distribution: Ubuntu 14.04
Posts: 155

Original Poster
Rep: Reputation: 15
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Ser Service Status: ser dead but subsys locked Reu Linux - Software 2 11-03-2007 12:00 PM
how to find a sendmail service status using heartbeat dhanju Linux - Networking 0 12-19-2005 01:58 AM
service httpd status, results in httpd dead but subsys locked squadja Red Hat 2 09-11-2004 10:31 PM
/sbin/service is empty every weekend and changed to service.1 LineS Linux - General 0 05-24-2004 02:08 AM
Warning in Service Status FreeFox Linux - General 4 08-25-2003 10:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 07:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration