tomcat55 startup script error?

Michael Kastner kastner at galt.de
Thu Feb 16 03:09:16 PST 2006


I got the same problem with tomcat50.

Which means have to kill the process if want to restart the server.

Also in this case the pid file /var/run/tomcat50.pid exists. I wonder, whether 
it could be connected to user rights on the pid file.

user www
group wheel

In order to restart the server, I actually have to kill the tomcat process.

Any help is appreciated.

Michael Kastner

Niek Dekker wrote:
> I installed the new tomcat55 port on feb. 12. on 6.0-RELEASE
> JDK is 1.5.0 native.
> 
> When I run the tomcat55.sh stop script, it says:
> 
> # /usr/local/etc/rc.d/tomcat55.sh stop
> tomcat55 not running? (check /var/run/tomcat55.pid).
> #
> 
> But the pid file is just there.
> 
> I would like to know what's wrong in the script. Here it is:
> 
> ==============
> #!/bin/sh
> #
> # $FreeBSD: ports/www/tomcat55/files/tomcat55.sh.in,v 1.3 2006/02/08
> 13:35:17 lawrance Exp $
> #
> 
> # PROVIDE: tomcat55
> # REQUIRE: NETWORKING SERVERS
> # BEFORE: DAEMON
> # KEYWORD: FreeBSD shutdown
> 
> #
> # Configuration settings for tomcat55 in /etc/rc.conf:
> #
> # tomcat55_enable (bool):
> #   Set to "NO" by default.
> #   Set it to "YES" to enable tomcat55
> #
> # tomcat55_flags (str):
> #   Set to "" by default.
> #   Extra flags passed to start command
> #
> # tomcat55_catalina_home (str)
> #   Set to "/usr/local/tomcat5.5" by default.
> #   Set the CATALINA_HOME variable for the Tomcat process
> #
> # tomcat55_catalina_base (str)
> #   Set to "/usr/local/tomcat5.5" by default.
> #   Set the CATALINA_BASE variable for the Tomcat process
> #
> # tomcat55_catalina_tmpdir (str)
> #   Set to "/usr/local/tomcat5.5/temp" by default.
> #   Set the CATALINA_TMPDIR variable for the Tomcat process
> #
> # tomcat55_stdout_log (str)
> #   Set to "/var/log/tomcat/stdout.log" by default.
> #   Set the location for the Tomcat process log (standard output)
> #
> # tomcat55_stderr_log (str)
> #   Set to "/var/log/tomcat/stderr.log" by default.
> #   Set the location for the Tomcat process log (error output)
> #
> # tomcat55_stop_timeout (num)
> #   Set to "10" by default.
> #   Sets the timeout in seconds to allow tomcat to shutdown.
> #   After the timeout has elapsed, tomcat will be killed.
> #
> # tomcat55_java_home (str):
> # tomcat55_java_vendor (str):
> # tomcat55_java_version (str):
> # tomcat55_java_os (str):
> #   Specify the requirements of the Java VM to use. See javavm(1).
> #
> # tomcat55_classpath (str):
> #   Set to "" by default.
> #   Addtional classes to add to the CLASSPATH
> #
> # tomcat55_java_opts (str):
> #   Set to "" by default.
> #   Java VM args to use.
> #
> 
> tomcat55_enable="${tomcat55_enable:-"NO"}"
> tomcat55_java_version="${tomcat55_java_version:-"1.4+"}"
> tomcat55_user="${tomcat55_user:-"root"}"
> tomcat55_catalina_home="${tomcat55_catalina_home:-"/usr/local/tomcat5.5"}"
> tomcat55_catalina_base="${tomcat55_catalina_base:-"/usr/local/tomcat5.5"}"
> tomcat55_catalina_tmpdir="${tomcat55_catalina_tmpdir:-"/usr/local/tomcat5.5/temp"}"
> tomcat55_stdout_log="${tomcat55_stdout_log:-"/var/log/tomcat/stdout.log"}"
> tomcat55_stderr_log="${tomcat55_stderr_log:-"/var/log/tomcat/stderr.log"}"
> tomcat55_stop_timeout="${tomcat55_stop_timeout:-"10"}"
> 
> . /etc/rc.subr
> 
> name="tomcat55"
> rcvar=`set_rcvar`
> pidfile="/var/run/tomcat55.pid"
> 
> load_rc_config "${name}"
> 
> if [ -n "${tomcat55_java_home}" ] ; then
>     export JAVA_HOME="${tomcat55_java_home}"
> fi
> 
> if [ -n "${tomcat55_java_version}" ] ; then
>     export JAVA_VERSION="${tomcat55_java_version}"
> fi
> 
> if [ -n "${tomcat55_java_vendor}" ] ; then
>     export JAVA_VENDOR="${tomcat55_java_vendor}"
> fi
> 
> if [ -n "${tomcat55_java_os}" ] ; then
>     export JAVA_OS="${tomcat55_java_os}"
> fi
> 
> export JAVA_HOME="/usr/local/jdk1.5.0"
> export JAVA_VERSION="1.5"
> export JAVA_VENDOR="SUN"
> export JAVA_OS="FreeBSD"
> 
> java_command="/usr/local/bin/java \
>     ${tomcat55_java_opts} \
>     -Djava.endorsed.dirs=$JAVA_ENDORSED_DIRS \
>     -classpath
> /usr/local/tomcat5.5/bin/bootstrap.jar:/usr/local/tomcat5.5/bin/commons-
> logging-api.jar:${tomcat55_classpath} \
>     -Dcatalina.base=${tomcat55_catalina_base} \
>     -Dcatalina.home=${tomcat55_catalina_home} \
>     -Djava.io.tmpdir=${tomcat55_catalina_tmpdir} \
>     org.apache.catalina.startup.Bootstrap"
> 
> log_args=">> ${tomcat55_stdout_log} \
>     2>> ${tomcat55_stderr_log} "
> 
> # Subvert the check_pid_file procname check.
> if [ -f $pidfile ]; then
>   read rc_pid junk < $pidfile
>   if [ ! -z "$rc_pid" ]; then
>     procname=`ps -o comm= $rc_pid`
>   fi
> fi
> 
> required_files="${tomcat55_catalina_home}/conf/server.xml"
> 
> command="/usr/sbin/daemon"
> flags="-p ${pidfile} ${java_command} start ${tomcat55_flags} ${log_args}"
> 
> start_precmd=pid_touch
> stop_cmd="tomcat55_stop"
> 
> pid_touch ()
> {
>     touch $pidfile
>     chown $tomcat55_user $pidfile
> }
> 
> tomcat55_stop() {
>     rc_pid=$(check_pidfile $pidfile $procname)
> 
>     if [ -z "$rc_pid" ]; then
>         [ -n "$rc_fast" ] && return 0
>         if [ -n "$pidfile" ]; then
>             echo "${name} not running? (check $pidfile)."
>         else
>             echo "${name} not running?"
>         fi
>         return 1
>     fi
> 
>     echo "Stopping ${name}."
>     ${java_command} stop
>     tomcat_wait_max_for_pid ${tomcat55_stop_timeout} ${rc_pid}
>     kill -KILL ${rc_pid} 2> /dev/null && echo "Killed."
>     echo -n > ${pidfile}
> }
> 
> tomcat_wait_max_for_pid() {
>     _timeout=$1
>     shift
>     _pid=$1
>     _prefix=
>     while [ $_timeout -gt 0 ] ; do
>         echo -n ${_prefix:-"Waiting (max $_timeout secs) for PIDS: "}$_pid
>         _prefix=", "
>         sleep 2
>         kill -0 $_pid 2> /dev/null || break
>         _timeout=$(($_timeout-2))
>     done
>     if [ -n "$_prefix" ]; then
>         echo "."
>     fi
> }
> 
> run_rc_command "$1"
> 
> ==============
> _______________________________________________
> freebsd-java at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-java
> To unsubscribe, send any mail to "freebsd-java-unsubscribe at freebsd.org"
> 



More information about the freebsd-java mailing list