LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 05-17-2005, 05:36 AM   #1
tuxfood
Member
 
Registered: Aug 2003
Location: kerala , India
Distribution: RH9 , FC1 ,
Posts: 141

Rep: Reputation: 15
Requisite for starting sevices in rh9


Hi ..

I am trying to figure out the dependencies between the services in my system i.e,
which all services to start before a particular service can be started.

For example ... vsftpd requires network.
netfs reuires network
some services require xinetd to be enabled before using them

I have read thru the /etc/rc.d/init.d scripts and have found out that most of the scripts just check for some service having enabled thru checking some variable..

eg : most of the scripts check whether network is up by checking the variable

NETWORKING which is declared in /etc/sysconfig/network.

Other scripts just assume the service has started by included the above file in the startup script.

How can we be sure whether any other service must have started before a particular service can be started. (of course apart from the trial and error method).

Any ideas ???

thnks

tuxfood
 
Old 05-17-2005, 10:06 PM   #2
cormander
Member
 
Registered: Dec 2004
Location: Hawaii
Distribution: Fedora & CentOS
Posts: 72

Rep: Reputation: 15
If the service runs as a daemon, you can see if it is running with the "pidof" command. If it returns nothing, the service is not running. Otherwise, it gives you the pid(s) of the process(es) running.

For example:

pidof httpd
15973 15938 5291 26219 26212 18519 14400 24442 24441 24317 21207 17957 17955 17954 17953 7161 18977 18797

That is the master process and all of it's children running.

/sbin/pidof asgasg


That returns nothing, naturally, because asgasg doesn't even exist, much less is running.

In bash, you can do something like this in a script:

Code:
#!/bin/bash

if [ -z "$(/sbin/pidof httpd)" ]; then

    echo "httpd is not running"

else

    echo "httpd is running"

fi
Hope this helps.
 
Old 05-19-2005, 01:52 AM   #3
tuxfood
Member
 
Registered: Aug 2003
Location: kerala , India
Distribution: RH9 , FC1 ,
Posts: 141

Original Poster
Rep: Reputation: 15
hi..

what i actually want is to find out which all services should be up before a particular service can be started

eg: vsftpd can be started only if network is up
httpd can be started only if network is up


etc

i hope i make myself clear

thnks
tuxfood
 
  


Reply



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
StartX -- help in starting X server in RH9 misterscorp Red Hat 2 10-21-2005 08:23 AM
starting apache2 on RH9 mjpuczko Red Hat 5 03-13-2004 02:45 AM
starting a service under RH9 linuxnube Linux - Software 3 12-18-2003 01:52 PM
starting fluxbox in rh9.0 shiny Linux - Software 6 05-31-2003 12:44 PM
/etc/services --> Can I comment a bunch of these sevices out ForumKid Linux - Security 1 12-27-2001 02:36 AM

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

All times are GMT -5. The time now is 07:28 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