Ticket #145 (closed defect: invalid)

Opened 19 months ago

Last modified 19 months ago

some perfectly running services are reported as crashed with openrc

Reported by: piavka@cs.bgu.ac.il Owned by: roy
Priority: major Milestone:
Component: rc Version: 0.4
Keywords: Cc: cooldwind@gmail.com

Description

The problem is that I got several init scripts that work ok with old baselayout-1* do not work properly with openrc. rc-status reports them as crashed while the services they start are running perfectly.

Can someone please shed the light on what is wrong with my init scripts below?
And how does openrc detect whether a service is crashed or not?

Here is one script - this one is repoeted as crashed with openrc-0.3 but running with openrc-0.4


cat /etc/init.d/mon

#!/sbin/runscript

depend() {

use netmount
need clock
after logger portmap quota

}

checkconfig() {

if [ ! -e /etc/mon/mon.cf ] ; then

eerror "You need an /etc/mon/mon.cf file to run mon"
eerror "There is a sample at /etc/mon/mon.cf.sample"
return 1

fi

}

start() {

checkconfig
return 1

ebegin "Starting mon"
start-stop-daemon --start --exec /usr/sbin/mon \

--pidfile /var/run/mod.pid \
-- -P /var/run/mon.pid -f

eend $?

}

stop() {

ebegin "Stopping mon"
start-stop-daemon --stop --retry 600 --pidfile /var/run/mon.pid
eend $?

}

ps -auxwww | grep $(cat /var/run/mon.pid)

Warning: bad ps syntax, perhaps a bogus '-'? See  http://procps.sf.net/faq.html
root 25961 0.0 0.3 51964 8924 ? S 2008 5:12 /usr/bin/perl /usr/sbin/mon -P /var/run/mon.pid -f

rc-status | grep mon

mon [ crashed ]

-------------------------------------

And another one - this one is reported as crashed with openrc-0.3

and i did not yet check it with openrc-0.4 - will do so soon:


cat /etc/init.d/tomcat

#!/sbin/runscript

depend() {

need net

}

init_tomcat_env() {

export JAVA_HOME=/usr/local/Java/LastJDK
export JDK_HOME=/usr/local/Java/LastJDK
export JRE_HOME=/usr/local/Java/LastJDK
export JAVAC=${JAVA_HOME}/bin/javac

}

start() {

init_tomcat_env
ebegin "Starting tomcat5.5"
start-stop-daemon --chdir /home/tomcat/web --chuid tomcat:tomcat \

--start --verbose --exec /home/tomcat/web/bin/catalina.sh -- start

eend $?

}

stop() {

init_tomcat_env
ebegin "Stopping tomcat5.5"
start-stop-daemon --chdir /home/tomcat/web --chuid tomcat:tomcat \

--start --verbose --exec /home/tomcat/web/bin/catalina.sh -- stop

eend $?

}

ps -auxwwww | grep tomcat

Warning: bad ps syntax, perhaps a bogus '-'? See  http://procps.sf.net/faq.html
tomcat 462 0.0 0.7 377684 73752 ? Sl Jan18 0:06 /usr/local/Java/LastJDK/bin/java -Djava.util.logging.config.file=/home/tomcat/web/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager? -Xms100m -Xmx200m -Djava.library.path=/home/tomcat/web/lib/native -Djava.endorsed.dirs=/home/tomcat/web/common/endorsed -classpath :/home/tomcat/web/bin/bootstrap.jar:/home/tomcat/web/bin/commons-logging-api.jar -Dcatalina.base=/home/tomcat/web -Dcatalina.home=/home/tomcat/web -Djava.io.tmpdir=/home/tomcat/web/temp org.apache.catalina.startup.Bootstrap start

rc-status | grep tomcat

tomcat [ crashed ]


Change History

comment:1 Changed 19 months ago by Santiago M. Mola <cooldwind@gmail.com>

  • Cc cooldwind@gmail.com added

comment:2 Changed 19 months ago by roy

  • Status changed from new to closed
  • Resolution set to invalid

mon works fine with 0.4.2

I doubt the tomcat ones does as it's treating /home/tomcat/web/bin/catalina.sh as a daemon and it's probably just a shell script that launches the real daemon.
That is an issue with the init script, not OpenRC.

In a nutshell, start-stop-daemon tries to ensure the process it started is still running. So using start-stop-daemon with shell scripts is a bad idea.

Please open a new bug if you think I'm wrong and attach the init script instead of posting it in the description field.

comment:3 follow-up: ↓ 4 Changed 19 months ago by piavka@cs.bgu.ac.il

So I understand that I need to move the /home/tomcat/web/bin/catalina.sh to /etc/init.d/tomcat
and change it so that start-stop-daemon starts/stops the java process directly?

comment:4 in reply to: ↑ 3 Changed 19 months ago by roy

Replying to piavka@…:

So I understand that I need to move the /home/tomcat/web/bin/catalina.sh to /etc/init.d/tomcat
and change it so that start-stop-daemon starts/stops the java process directly?

Yes

Or stop using start-stop-daemon for that init script.

The choice is yours :)

Note: See TracTickets for help on using tickets.