I have gotten daemon working with my application. I am using daemon to launch tomcat with a special script that does some unusual things I need to do. I created a script in /etc/rc.d/init.d to launch my daemon and it successfully launches tomcat on boot with the proper settings needed to run my app. My daemon appears in the RedHat services application, where it can be started and stopped.

The only problem is with the "status" command. I have tried various things copied from other daemon scripts that come with RedHat (running under RHEL4) and I don't know enough to know a reliable way of getting the status of a jsvc-launched application. Can someone explain how this is done?

I tried this and it doesn't work. Even though Tomcat and my webapp are running fine, the script reports "dead but pid file exists".


dostatus() {
_status mydaemon
}

_status() {
local base=${1##*/}
local pid

# Test syntax.
if [ "$#" = 0 ] ; then
echo $"Usage: status {program}"
return 1
fi

# First try "pidof"
pid=`/sbin/pidof -o $$ -o $PPID -o %PPID -x $1 || \
/sbin/pidof -o $$ -o $PPID -o %PPID -x ${base}`
if [ -n "$pid" ]; then
echo $"${base} (pid $pid) is running..."
return 0
fi

# Next try "/var/run/*.pid" files
if [ -f $PIDFILE ] ; then
read pid < $PIDFILE
if [ -n "$pid" ]; then
echo $"${base} dead but pid file exists"
return 1
fi
fi
# See if /var/lock/subsys/${base} exists
if [ -f /var/lock/subsys/${base} ]; then
echo $"${base} dead but subsys locked"
return 2
fi
echo $"${base} is stopped"
return 3
}



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to