equivalent of SuSE's checkproc

John DeDourek dedourek at unb.ca
Fri Feb 24 13:44:57 UTC 2006


Christofer C. Bell wrote:

>On 2/22/06, Bob Hartung <rwhart at mchsi.com> wrote:
>  
>
>>Hi all,
>>   I am trying to modify a SuSE init script to start Tomcat 5.5. It uses
>>checkproc which I do not find on the FC4 install.  What FC4 program
>>provides similiar utility?
>>    
>>
>
>I don't know what checkproc does, but I'm assuming it checks to see if
>a service is already running.  That's provided by the daemon function
>in /etc/init.d/functions which is normally sourced by every script in
>/etc/init.d.
>
>Note that the following is at the top of every Fedora supplied init script:
>
># source function library
>. /etc/init.d/functions
>
>If you refer to that script, you'll see the following is part of the
>daemon() shell function:
>
>        # See if it's already running. Look *only* at the pid file.
>        if [ -f /var/run/${base}.pid ]; then
>                local line p
>                read line < /var/run/${base}.pid
>                for p in $line ; do
>                        [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid $p"
>                done
>        fi
>
>Anyway, like I said, I'm not sure what checkproc does, but if there's
>anything you need to know about Fedora specific enhancements to the
>system initialization process, you're likely to find it in
>/etc/init.d/function.
>
>Good luck!
>
>--
>Chris
>
>"I trust the Democrats to take away my money, which I can afford.  I
>trust the Republicans to take away my freedom, which I cannot."
>
>  
>
In Fedora, I normally use the following to check the status of a "service"

/sbin/service nameofservice status

where nameofservice must be one of the names listed of you do

ls /etc/rc.d/init.d

For example,

/sbin/service ntpd status

gives:

ntpd (pid 2598) is running...

Further explanation:  the "programs" in /etc/rc.d/init.d (typically
bash scripts) are run by /sbin/service with the indicated argument,
e.g. "status".  Generally, the programs/scripts have in them
whatever code is necessary to determine the status for a particular
service.  These scripts are installed by the rpm.  Of course, if
you create a service from a program in a tarball or something, you
would need to create the appropriate program/script in init.d to
make this work.

note that
/sbin/service ntpd stop
/sbin/service nptd start
/sbin/service ntpd restart
are also supported.

If you want programs to start automatically, you can use /sbin/chkconfig
(man chkconfig) for more information.  This adjusts the entries in
/etc/rc.d/rc.5  (or /etc/rc.d/rc.3 if you boot to command mode).  I
admit that I use the GUI (somewhere under system settings and/or services)
rather than figure out the command syntax of chkconfig.




More information about the fedora-list mailing list