Missing from the glassfishv2 package

Aaron J. Zirbes ajz at umn.edu
Fri May 2 22:38:22 BST 2008


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ajz.vcf
Type: text/x-vcard
Size: 317 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/ubuntu-motu/attachments/20080502/8eb0758b/attachment.vcf 


More information about the Ubuntu-motu mailing list