diff options
author | abs <abs> | 2001-05-24 16:06:43 +0000 |
---|---|---|
committer | abs <abs> | 2001-05-24 16:06:43 +0000 |
commit | e4b091ed21ab0a0cb0ef24ffaeaedb90853652cf (patch) | |
tree | 4893cd8e54003ed136e99b05dc0f49382c406b31 /www/jakarta-tomcat | |
parent | 7ab02c62a1890f6c3a985cb56c472311cdbef946 (diff) | |
download | pkgsrc-e4b091ed21ab0a0cb0ef24ffaeaedb90853652cf.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/jakarta-tomcat')
-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 |