java/jboss72: distfile rerolled and enhance rc script

Distfile was rerolled, maintainer has checked that there are no spurious changes

RC script now can be tuned to hard way kill stuck JBoss or any child
processes preventing restart; RC script can be configured to make a
delay after killing (for example for restart).

Add LICENSE info.

PR:		ports/178142
Submitted by:	Alexander Yerenkow <yerenkow@gmail.com> (maintainer)
This commit is contained in:
Chris Rees 2013-05-04 18:27:34 +00:00
parent 20c23392dd
commit fcbe324489
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=317332
3 changed files with 26 additions and 9 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= jboss72
PORTVERSION= 7.2.0
#PORTREVISION= 0
PORTREVISION= 1
#PORTEPOCH= 0
CATEGORIES= java www
MASTER_SITES= https://javaz.org/distfiles/
@ -13,6 +13,8 @@ DISTFILES= m2-${DISTNAME}.tar.xz ${DISTNAME}.tar.gz
MAINTAINER= yerenkow@gmail.com
COMMENT= JBoss 7.2.0.Final
LICENSE= GPLv2
USE_GITHUB= YES
GH_ACCOUNT= jbossas
GH_PROJECT= jboss-as

View File

@ -1,4 +1,4 @@
SHA256 (m2-jboss-as-7.2.0.Final.tar.xz) = 64ec350d5ebb41d1fbe15f5ba18e37f94425007eba2dac407c2ad35128efa989
SIZE (m2-jboss-as-7.2.0.Final.tar.xz) = 159788916
SHA256 (jboss-as-7.2.0.Final.tar.gz) = e6de3007f7f260677626a2cb244183c80ea461735b5da568d10e02fe2f841e77
SIZE (jboss-as-7.2.0.Final.tar.gz) = 14962672
SHA256 (jboss-as-7.2.0.Final.tar.gz) = 5fd993b358e1650f91293bcc04f4b72fa81c0d25c775d689e30ea69fad294c32
SIZE (jboss-as-7.2.0.Final.tar.gz) = 14956639

View File

@ -7,6 +7,7 @@
# PROVIDE: %%APP_SHORTNAME%%
# REQUIRE: NETWORKING SERVERS
# KEYWORD: shutdown
# Add the following lines to /etc/rc.conf to enable %%APP_SHORTNAME%%:
# %%APP_SHORTNAME%%_enable (bool): Set to "YES" to enable %%APP_SHORTNAME%%
@ -17,9 +18,6 @@
. /etc/rc.subr
%%APP_SHORTNAME%%_user="%%USER%%"
%%APP_SHORTNAME%%_logdir="%%LOG_DIR%%"
name="%%APP_SHORTNAME%%"
rcvar=%%APP_SHORTNAME%%_enable
@ -27,6 +25,11 @@ load_rc_config $name
%%APP_SHORTNAME%%_enable="${%%APP_SHORTNAME%%_enable:-"NO"}"
%%APP_SHORTNAME%%_logging="${%%APP_SHORTNAME%%_logging:-">> ${%%APP_SHORTNAME%%_logdir}/stdout.log 2>> ${%%APP_SHORTNAME%%_logdir}/stderr.log"}"
%%APP_SHORTNAME%%_sleep="${%%APP_SHORTNAME%%_sleep:-"5"}"
%%APP_SHORTNAME%%_kill9="${%%APP_SHORTNAME%%_kill9:-""}"
%%APP_SHORTNAME%%_additional_killall="${%%APP_SHORTNAME%%_additional_killall:-""}"
%%APP_SHORTNAME%%_user="%%USER%%"
%%APP_SHORTNAME%%_logdir="%%LOG_DIR%%"
start_cmd="%%APP_SHORTNAME%%_start"
stop_cmd="%%APP_SHORTNAME%%_stop"
@ -38,14 +41,13 @@ JBOSS_HOME="%%APP_HOME%%"
{
if [ ! -d "${%%APP_SHORTNAME%%_logdir}" ]
then
mkdir -p ${%%APP_SHORTNAME%%_logdir}
chown ${%%APP_SHORTNAME%%_user} ${%%APP_SHORTNAME%%_logdir}
install -d -o ${%%APP_SHORTNAME%%_user} ${%%APP_SHORTNAME%%_logdir}
fi
echo "Starting %%APP_SHORTNAME%%."
daemon -u ${%%APP_SHORTNAME%%_user} ${JBOSS_HOME}/bin/standalone.sh ${%%APP_SHORTNAME%%_logging} >> ${%%APP_SHORTNAME%%_logdir}/boot.log 2>> ${%%APP_SHORTNAME%%_logdir}/boot.log
sleep 1 # let daemon(8) and sh(1) finish before executing pgrep(1)
sleep ${%%APP_SHORTNAME%%_sleep} # let daemon(8) and sh(1) finish before executing pgrep(1)
pgrep -U ${%%APP_SHORTNAME%%_user} -f ${JBOSS_HOME}/modules > ${pidfile}
chown ${%%APP_SHORTNAME%%_user} $pidfile
}
@ -56,6 +58,19 @@ JBOSS_HOME="%%APP_HOME%%"
if [ -f ${pidfile} ]
then
kill `cat ${pidfile}`
# Only if we aware that our setup can hangs, and only after trying simple kill, we can kill it hard way.
if [ ! -z "${%%APP_SHORTNAME%%_kill9}" ]
then
sleep ${%%APP_SHORTNAME%%_sleep}
kill -9 `cat ${pidfile}`
fi
# In some setups, JBoss can spawn some child processess, which could prevent it from stopping, and freeing net ports.
# Let's blindly kill them all, since we are really know what we are doing.
if [ ! -z "${%%APP_SHORTNAME%%_additional_killall}" ]
then
sleep ${%%APP_SHORTNAME%%_sleep}
killall ${%%APP_SHORTNAME%%_additional_killall}
fi
fi
}