From owner-freebsd-questions@FreeBSD.ORG Mon May 22 15:26:01 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 215F816B57A for ; Mon, 22 May 2006 15:26:01 +0000 (UTC) (envelope-from work@ashleymoran.me.uk) Received: from mercureh.reacthosting.com (reacthosting.com [195.177.245.34]) by mx1.FreeBSD.org (Postfix) with ESMTP id A8A1443D49 for ; Mon, 22 May 2006 15:26:00 +0000 (GMT) (envelope-from work@ashleymoran.me.uk) Received: from hosta.jigsawfinance.com ([213.106.224.113] helo=alfie.jigsawhq.com) by mercureh.reacthosting.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.62 (FreeBSD)) (envelope-from ) id 1FiCIA-000Ppi-Gg for freebsd-questions@freebsd.org; Mon, 22 May 2006 16:25:58 +0100 From: Ashley Moran Organization: Codeweavers Ltd To: freebsd-questions@freebsd.org Date: Mon, 22 May 2006 16:25:24 +0100 User-Agent: KMail/1.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200605221625.24992.work@ashleymoran.me.uk> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - mercureh.reacthosting.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [26 6] X-AntiAbuse: Sender Address Domain - ashleymoran.me.uk X-Source: X-Source-Args: X-Source-Dir: Subject: Getting JAVA_HOME for a jetty rc script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 May 2006 15:26:11 -0000 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