Getting JAVA_HOME for a jetty rc script

Ashley Moran work at ashleymoran.me.uk
Mon May 22 08:26:11 PDT 2006


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


More information about the freebsd-questions mailing list