diff options
author | abs <abs@pkgsrc.org> | 2001-05-24 16:06:43 +0000 |
---|---|---|
committer | abs <abs@pkgsrc.org> | 2001-05-24 16:06:43 +0000 |
commit | d9a13bd4660dce5ace702d6d4796ac192376712d (patch) | |
tree | 4893cd8e54003ed136e99b05dc0f49382c406b31 /www | |
parent | c0a8dd3e66f1196bc4d6595ceab0e51b803e426f (diff) | |
download | pkgsrc-d9a13bd4660dce5ace702d6d4796ac192376712d.tar.gz |
Obey rc.conf if present (modelled on apache rc.d file), plus allow entries
to be prepended to CLASSPATH by setting optional tomcat_classpath
Diffstat (limited to 'www')
-rw-r--r-- | www/jakarta-tomcat/files/tomcat.sh | 82 |
1 files changed, 60 insertions, 22 deletions
diff --git a/www/jakarta-tomcat/files/tomcat.sh b/www/jakarta-tomcat/files/tomcat.sh index cee849db0d2..5dda4fb5df6 100644 --- a/www/jakarta-tomcat/files/tomcat.sh +++ b/www/jakarta-tomcat/files/tomcat.sh @@ -1,9 +1,12 @@ #! /bin/sh # -# $NetBSD: tomcat.sh,v 1.4 2001/04/13 07:47:43 jwise Exp $ +# $NetBSD: tomcat.sh,v 1.5 2001/05/24 16:06:43 abs Exp $ # # PROVIDE: tomcat # REQUIRE: DAEMON +# +# To start tomcat at startup, copy this script to /etc/rc.d and set +# tomcat=YES in /etc/rc.conf. PREFIX=@PREFIX@ @@ -13,37 +16,72 @@ then export JAVA_HOME fi -CLASSPATH=${CLASSPATH}:${PREFIX}/lib/java/servlet.jar:${PREFIX}/lib/java/jaxp.jar:${PREFIX}/lib/java/parser.jar -export CLASSPATH - name="tomcat" +rcvar=$name command="${PREFIX}/tomcat/bin/tomcat.sh" -cmd=${1:-start} +# set defaults +if [ -r /etc/rc.conf ] +then + . /etc/rc.conf +else + eval ${rcvar}=YES +fi -if [ -x ${command} ] +# $flags from environment overrides ${rcvar}_flags +if [ -n "${flags}" ] then - case ${cmd} in - run|start) - echo "Starting ${name}." - (cd ${PREFIX}/tomcat && ${command} ${cmd}) - ;; + eval ${rcvar}_flags="${flags}" +fi - stop) - echo "Stopping ${name}." - (cd ${PREFIX}/tomcat && ${command} ${cmd}) - ;; +CLASSPATH=${CLASSPATH}:${PREFIX}/lib/java/servlet.jar:${PREFIX}/lib/java/jaxp.jar:${PREFIX}/lib/java/parser.jar +if [ -n "${tomcat_classpath}" ] +then + CLASSPATH=${CLASSPATH}:${tomcat_classpath} +fi +export CLASSPATH - restart) - ( $0 stop ) - sleep 5 - $0 start - ;; +cmd=${1:-start} +checkyesno() +{ + eval _value=\$${1} + case $_value in + [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) return 0 ;; + [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) return 1 ;; *) - echo 1>&2 "Usage: $0 [restart|start|stop]" - exit 1 + echo "\$${1} is not set properly." + return 1 ;; esac +} + +if checkyesno ${rcvar} +then + if [ -x ${command} ] + then + case ${cmd} in + run|start) + echo "Starting ${name}." + (cd ${PREFIX}/tomcat && ${command} ${cmd}) + ;; + + stop) + echo "Stopping ${name}." + (cd ${PREFIX}/tomcat && ${command} ${cmd}) + ;; + + restart) + ( $0 stop ) + sleep 5 + $0 start + ;; + + *) + echo 1>&2 "Usage: $0 [restart|start|stop]" + exit 1 + ;; + esac + fi fi exit 0 |