Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 May 2006 16:25:24 +0100
From:      Ashley Moran <work@ashleymoran.me.uk>
To:        freebsd-questions@freebsd.org
Subject:   Getting JAVA_HOME for a jetty rc script
Message-ID:  <200605221625.24992.work@ashleymoran.me.uk>

next in thread | raw e-mail | index | archive | help
Just installed Jetty and I wanted to control it with an rc script, live every 
other port I've installed ;o)

I came up with a simple wrapper to the handy script provided by jetty (see 
below).  Copy and paste from the Postgres script is about the extent of my rc 
skills right now...

I'm actually happy with it for my limited purpose, the only thing I don't like 
is hard-coding the JAVA_HOME value in there.  I thought there would be a way 
of determining this (javavmwrapper does it obviously) but I can't figure it 
out.

Any clues anyone?  (Also, any feedback? Does anyone else here miss an rc 
script for Jetty?)

Cheers
Ashley



#!/bin/sh

# PROVIDE: jetty
# REQUIRE: LOGIN
# KEYWORD: shutdown

#
# Add the following line to /etc/rc.conf to enable jetty:
# jetty_enable (bool):   Set to "NO" by default.
#                        Set it to "YES" to enable Jetty.
# jetty_java_home (str): Set to "/usr/local/jdk1.5.0" by default.
#

. /etc/rc.subr

load_rc_config jetty

name="jetty"
rcvar=`set_rcvar`
command="/usr/local/sbin/jetty"
extra_commands="run check supervise demo"

start_cmd="$command start"
stop_cmd="$command stop"
run_cmd="$command run"
restart_cmd="$command restart"
status_cmd="$command check"
check_cmd="$command check"
supervise_cmd="$command supervise"
demo_cmd="$command demo"

jetty_enable=${jetty_enable:-"NO"}
jetty_java_home=${jetty_java_home:-"/usr/local/jdk1.5.0"}

export JAVA_HOME=$jetty_java_home

run_rc_command "$1"

-- 
"If you do it the stupid way, you will have to do it again"
  - Gregory Chudnovsky



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605221625.24992.work>