LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 07-18-2006, 10:57 AM   #1
jdaniels73
LQ Newbie
 
Registered: Jul 2006
Posts: 16

Rep: Reputation: 0
Problem monitoring JRun 4 processes via inittab (respawning too fast) - RHEL3 U4


Hi all,

Environment:
- RedHat Enterprise 3 Update 4 (Taroon)
- JRun 4 Updater 4
- Kernel 2.4.21-27.ELsmp

I am attempting to monitor an instance of JRun 4 Updater 4 appserver by adding the following to /etc/inittab:

jd1:35:respawn:/home/appserv/jrun4/bin/jrun -config /home/appserv/jrun4/bin/myapp.config -nohup -start myapp 1>/home/appserv/jrun4/bin/myapp.out 2>/home/appserv/jrun4/bin/myapp.err &

I intend to have init check that the process is running, and respawn it if it is not. I have tried executing the line "/home/appserv/jrun4/bin/jrun -config /home/appserv/jrun4/bin/myapp.config -nohup -start myapp 1>/home/appserv/jrun4/bin/myapp.out 2>/home/appserv/jrun4/bin/myapp.err &" as root to imitate the way init runs it. That seems to work fine.

However, if I reload the /etc/inittab file (using "init q") I get the following error in the /var/log/messages file:

Jul 18 16:14:24 ops-testing init: Re-reading inittab
Jul 18 16:14:24 ops-testing init: Id "jd1" respawning too fast: disabled for 5 minutes

As I said, the actual process runs OK, so it's not as if it crashes, attempts to restart, crashes again, then pasuses for 5 minsutes as stated in the log above. It also doesn't fork, so it doesn't lose track of the parent process: when I run it from the command line, the single process that runs has a parent process ID which is the same as the bash shell from where I run it.

[EDIT 1] I also tried running Jrun without sending it to the background (I also did that with the simple daemon). Same problem [EDIT 1]

[EDIT 2]Incidentally the process does start but the fact that it won't be checked for 5 minutes is what bothers me.[EDIT 2]

I've tried running simple non-forking daemons in the same way. They have the same problem.

Could anyone shed any light on why init is not respawning a simple daemon properly, and also how I could work around it?

Many thanks,
Jon Daniels

Last edited by jdaniels73; 07-18-2006 at 12:32 PM.
 
Old 07-18-2006, 12:01 PM   #2
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 50
Why don't you add JRun to your init scripts. (/etc/rc.local or /etc/rc.d)
 
Old 07-18-2006, 12:15 PM   #3
jdaniels73
LQ Newbie
 
Registered: Jul 2006
Posts: 16

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by mrcheeks
Why don't you add JRun to your init scripts. (/etc/rc.local or /etc/rc.d)
I do have Jrun listed in the init scripts list, but my understanding is that having it in there won't instantly restart Jrun in the event of it stopping, which is what I want.

Thanks,
Jon
 
Old 08-09-2006, 08:37 AM   #4
jdaniels73
LQ Newbie
 
Registered: Jul 2006
Posts: 16

Original Poster
Rep: Reputation: 0
My workaround for this is to use DJB's 'daemontools' (I use v0.76) - initially daemontools tried to rerun too many instances of the appserver at once, much like inittab, but here's a neat run script that I used for Apache monitoring also (should be usable for any process):

Code:
#!/bin/sh

# get the pidno[s] of the process[es] you want to monitor
pidno=$( ps ax | grep <MYRPOCESSNAME> | grep -v grep | grep -v supervise)

# only execute if no process no. found
if [ -z $pidno ]; then
        exec 2>&1
        echo "Starting MYPROCESS instance"
        # maybe put snmptrap commands here
        exec /path/to/<MYPROCESSNAME> -arg1 
fi
The only oddity here is the value of the C field (if you do ps -ef | grep <MYPROCESSNAME>) comes up as a gradually decreasing value. I am under the impression that this field is obsolete so I am unsure how much of a problem this is.

Thanks,
Jon

Last edited by jdaniels73; 08-09-2006 at 08:42 AM.
 
  


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
Id X respawning too fast meInDaHouse Linux - Hardware 2 01-05-2005 05:05 PM
Linux Red Hat 9 start up problem - Init ID X respawning too fast RahmanJan Red Hat 2 08-14-2004 08:06 PM
monitoring active processes and identifying the required processes. gajaykrishnan Programming 2 08-13-2004 01:58 AM
INIT:Id "x" respawning too fast: disabled for 5 minutes problem satimis Red Hat 4 07-22-2004 06:03 AM
Respawning too fast problem isoaga Linux - Newbie 3 11-04-2002 06:23 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration