added fixed (?) ebuild for jboss-as-bin (copied from cvut overlay)

This commit is contained in:
Manuel Friedli 2014-01-15 16:13:08 +00:00
parent 01e49c33ba
commit d31a02a67e
4 changed files with 290 additions and 0 deletions

View file

@ -0,0 +1,53 @@
# Config file for /etc/init.d/__JBOSS_NAME__
# Location of the standalone server directory
#
SERVER_BASE_DIR="/var/lib/__JBOSS_NAME__"
# Directory with configuration files
#
#SERVER_CONFIG_DIR="/etc/__JBOSS_NAME__"
# The main server configuration file
#
#SERVER_CONFIG="standalone.xml"
# Where to put log files
#
#SERVER_LOG_DIR="/var/log/__JBOSS_NAME__"
# User who should own the process.
#
#JBOSS_USER=jboss
#JBOSS_GROUP=jboss
# The amount of time to wait for startup
#
#STARTUP_WAIT=60
# The amount of time to wait for shutdown
#
#SHUTDOWN_WAIT=30
# Uncomment the following line to prevent manipulation of JVM options
# by shell scripts.
#
#PRESERVE_JAVA_OPTS=true
# Specify options to pass to the Java VM.
#
JAVA_OPTS="-Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true"
JAVA_OPTS="$JAVA_OPTS -Djboss.server.default.config=standalone.xml"
# Sample JPDA settings for remote socket debugging
#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
# Sample JPDA settings for shared memory debugging
#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_shmem,server=y,suspend=n,address=jboss"
# Uncomment to not use JBoss Modules lockless mode
#JAVA_OPTS="$JAVA_OPTS -Djboss.modules.lockless=false"
# Uncomment to gather JBoss Modules metrics
#JAVA_OPTS="$JAVA_OPTS -Djboss.modules.metrics=true"

View file

@ -0,0 +1,118 @@
#!/sbin/runscript
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
name="JBoss AS (standalone)"
description="JBoss Application Server __JBOSS_VER__ in standalone mode"
depend() {
need net
use dns
provide jboss-as
}
init_vars() {
jboss_home="/opt/__JBOSS_NAME__"
temp_dir="/var/tmp/__JBOSS_NAME__"
pidfile="/var/run/__JBOSS_NAME__/standalone.pid"
base_dir=${SERVER_BASE_DIR:-"/var/lib/__JBOSS_NAME__"}
data_dir=${SERVER_DATA_DIR:-"${base_dir}/data"}
deploy_dir=${SERVER_DEPLOY_DIR:-"${data_dir}/content"}
config_dir=${SERVER_CONFIG_DIR:-"/etc/__JBOSS_NAME__"}
log_dir=${SERVER_LOG_DIR:-"/var/log/__JBOSS_NAME__"}
config=${SERVER_CONFIG:-"standalone.xml"}
user=${JBOSS_USER:-"jboss"}
group=${JBOSS_GROUP:-"jboss"}
startup_wait=${STARTUP_WAIT:-"60"}
shutdown_wait=${SHUTDOWN_WAIT:-"30"}
console_log="${log_dir}/console.log"
jboss_opts="-Djboss.server.base.dir=${base_dir}"
jboss_opts="${jboss_opts} -Djboss.server.config.dir=${config_dir}"
jboss_opts="${jboss_opts} -Djboss.server.data.dir=${data_dir}"
jboss_opts="${jboss_opts} -Djboss.server.log.dir=${log_dir}"
jboss_opts="${jboss_opts} -Djboss.server.temp.dir=${temp_dir}"
jboss_opts="${jboss_opts} -Djboss.server.deploy.dir=${deploy_dir}"
command="${jboss_home}/bin/standalone.sh"
command_args="${jboss_opts} --server-config ${config} ${JBOSS_OPTIONS}"
}
init_env_vars() {
# Configuration variables for JBoss script
export JAVA_HOME=`java-config --jre-home`
export JAVA_OPTS
export JBOSS_HOME=${jboss_home}
export JBOSS_PIDFILE="${pidfile}"
export LAUNCH_JBOSS_IN_BACKGROUND=1
}
start_pre() {
init_vars
init_env_vars
if [ ! -d ${base_dir} ]; then
eerror "Server base directory ${base_dir} does not exist!"
exit 2
fi
if [ ! -f "${config_dir}/${config}" ]; then
eerror "Configuration file ${config} does not exist!"
exit 2
fi
if [ ${user} = "root" ]; then
eerror "It's not a good idea to run as root!"
exit 2
fi
checkpath -d -o ${user} "${config_dir}"
checkpath -d -o ${user} "${log_dir}"
checkpath -d -o "${user}:${group}" -m750 "${data_dir}"
checkpath -d -o "${user}:${group}" -m750 "${deploy_dir}"
checkpath -d -o "${user}:${group}" -m700 "${temp_dir}"
checkpath -d -o "${user}:${group}" -m700 `dirname ${pidfile}`
checkpath -f -o ${user} "${console_log}"
cat /dev/null > "${console_log}"
}
start() {
ebegin "Starting JBoss Application Server __JBOSS_VER__"
start-stop-daemon --start --background --quiet \
--user="${user}:${group}" \
--pidfile="${pidfile}" \
--stdout "${console_log}" --stderr "${console_log}" \
--exec ${command} -- ${command_args} \
count=0; result=1
until [ $count -gt $startup_wait ]; do
grep 'JBoss AS.*started in' "$console_log" > /dev/null
if [ $? -eq 0 ] ; then
result=0
break
fi
sleep 1
let count=$count+1;
done
eend $result
}
stop() {
ebegin "Stopping JBoss Application Server __JBOSS_VER__"
init_vars
start-stop-daemon --stop --quiet \
--pidfile=${pidfile} \
--retry=TERM/${shutdown_wait}/KILL/10 \
--exec ${command} -- ${command_args}
eend $?
}