Upon trying to setup a Glassfish v2 server on Ubuntu 8.04 Server from a base 
install I ran into the
following issues.

1.) Package 'glassfishv2' should require package 'sun-java6-jdk' or 
'sun-java5-jdk'
Without either of these package, the install process fails.

2.) As with any server, it should be able to start at boot. To solve this, the 
following files need
to be added to the distribution (or variants thereof)

2a.) /etc/default/glassfishv2

# Default settings for glassfishv2. This file is sourced by /bin/sh from
# /etc/init.d/glassfishv2.

# Location of glassfish
GLASSFISH_HOME=/usr/share/glassfishv2

# Name of admin user
ADMIN_USER=admin

# Location of Glassfish Domains
GF_DOMAIN_DIR=/var/lib/glassfishv2/domains

# Location of auto-start passwords
ADMIN_PASSWORD_FILE=$GLASSFISH_HOME/config/install/default/passwordfile

# Name of domain to startup
DEFAULT_DOMAIN=domain1

2b.) /etc/init.d/glassfishv2
#! /bin/sh

### BEGIN INIT INFO
# Provides:             glassfishv2
# Required-Start:       $network $local_fs $remote_fs
# Required-Stop:
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    Sun's Java Application Server
### END INIT INFO

set -e

# /etc/init.d/glassfishv2: start and stop the Sun Glassfish v2.0 server

# Default Glassfish Install base
GLASSFISH_HOME=/usr/share/glassfishv2

test -x $GLASSFISH_HOME/bin/asadmin || exit 0

if test -f /etc/default/glassfishv2; then
    . /etc/default/glassfishv2
fi

. /lib/lsb/init-functions

# Are we running from init?
run_by_init() {
    ([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ]
}

export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"

case "$1" in
  start)
        log_daemon_msg "Starting Glassfish v2 server" "glassfishv2"
        if $GLASSFISH_HOME/bin/asadmin start-domain \
                --terse=true --interactive=false --user $ADMIN_USER \
                --passwordfile $ADMIN_PASSWORD_FILE \
                --domaindir $GF_DOMAIN_DIR $DEFAULT_DOMAIN; then
            log_end_msg 0
        else
            log_end_msg 1
        fi
        ;;
  stop)
        log_daemon_msg "Stopping Glassfish v2 server" "glassfishv2"
        if $GLASSFISH_HOME/bin/asadmin stop-domain \
            --terse=true \
            --domaindir $GF_DOMAIN_DIR $domain; then
            log_end_msg 0
        else
            log_end_msg 1
        fi

  restart)
        $0 stop
        sleep 2
        $0 start
        ;;

  *)
        log_action_msg "Usage: /etc/init.d/glassfishv2 {start|stop|restart}"
        exit 1
esac

exit 0

2c.) The init.d rc2 link needs to be created
cd /etc/rc2.d

sudo ln -s ../init.d/glassfishv2 S80glassfishv2



NOTE: These scripts work for me, but someone with more init experience should 
look them over.

--
Aaron J. Zirbes
Environmental Health Sciences
University of Minnesota

begin:vcard
fn:Aaron J. Zirbes
n:Zirbes;Aaron
org:University of Minnesota;Environmental Health Sciences
adr:;;200 Oak St SE Ste 350;Minneapolis;MN;55455;United States
email;internet:[EMAIL PROTECTED]
title:Systems Administrator
tel;work:612-625-3460
x-mozilla-html:FALSE
url:http://www.cccs.umn.edu/
version:2.1
end:vcard

-- 
Ubuntu-motu mailing list
Ubuntu-motu@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-motu

Reply via email to