Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Apr 2013 13:00:45 GMT
From:      Alexander Yerenkow <yerenkow@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/178142: jboss72 update of changed github tarballs plus enhance rc script
Message-ID:  <201304251300.r3PD0jxj004473@red.freebsd.org>
Resent-Message-ID: <201304251310.r3PDA0d4096396@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         178142
>Category:       ports
>Synopsis:       jboss72 update of changed github tarballs plus enhance rc script
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 25 13:10:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Alexander Yerenkow
>Release:        FreeBSD 9.1
>Organization:
>Environment:
>Description:
jboss72 update of changed github tarballs plus enhance rc script:

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).
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	jboss72/files/jboss72.in
#
echo x - jboss72/files/jboss72.in
sed 's/^X//' >jboss72/files/jboss72.in << 'a192e971ca37e5168d8ee2a7f5ff7f28'
X#!/bin/sh
X#
X# %%APP_SHORTNAME%% startup script.
X#
X# $FreeBSD: java/jboss72/files/jboss72.in 314186 2013-03-14 21:22:00Z crees $
X#
X
X# PROVIDE: %%APP_SHORTNAME%%
X# REQUIRE: NETWORKING SERVERS
X
X# Add the following lines to /etc/rc.conf to enable %%APP_SHORTNAME%%:
X# %%APP_SHORTNAME%%_enable (bool):      Set to "YES" to enable %%APP_SHORTNAME%%
X# %%APP_SHORTNAME%%_jvm_opts (str):     Extra JVM flags.
X# %%APP_SHORTNAME%%_args (str):         Optional arguments to JBoss
X# %%APP_SHORTNAME%%_logging (str)       JBoss log output. A pipe command may be used.
X#
X
X. /etc/rc.subr
X
X%%APP_SHORTNAME%%_user="%%USER%%"
X%%APP_SHORTNAME%%_logdir="%%LOG_DIR%%"
X
Xname="%%APP_SHORTNAME%%"
Xrcvar=%%APP_SHORTNAME%%_enable
X
Xload_rc_config $name
X
X%%APP_SHORTNAME%%_enable="${%%APP_SHORTNAME%%_enable:-"NO"}"
X%%APP_SHORTNAME%%_logging="${%%APP_SHORTNAME%%_logging:-">> ${%%APP_SHORTNAME%%_logdir}/stdout.log 2>> ${%%APP_SHORTNAME%%_logdir}/stderr.log"}"
X%%APP_SHORTNAME%%_sleep="${%%APP_SHORTNAME%%_sleep:-"5"}"
X%%APP_SHORTNAME%%_kill9="${%%APP_SHORTNAME%%_kill9:-""}"
X%%APP_SHORTNAME%%_additional_killall="${%%APP_SHORTNAME%%_additional_killall:-""}"
X
Xstart_cmd="%%APP_SHORTNAME%%_start"
Xstop_cmd="%%APP_SHORTNAME%%_stop"
Xpidfile="%%PID_FILE%%"
X
XJBOSS_HOME="%%APP_HOME%%"
X
X%%APP_SHORTNAME%%_start ()
X{
X	if [ ! -d "${%%APP_SHORTNAME%%_logdir}" ]
X	then
X		mkdir -p ${%%APP_SHORTNAME%%_logdir}
X		chown ${%%APP_SHORTNAME%%_user} ${%%APP_SHORTNAME%%_logdir}
X	fi
X
X	echo "Starting %%APP_SHORTNAME%%."
X	daemon -u ${%%APP_SHORTNAME%%_user} ${JBOSS_HOME}/bin/standalone.sh ${%%APP_SHORTNAME%%_logging} >> ${%%APP_SHORTNAME%%_logdir}/boot.log 2>> ${%%APP_SHORTNAME%%_logdir}/boot.log
X
X	sleep ${%%APP_SHORTNAME%%_sleep}	# let daemon(8) and sh(1) finish before executing pgrep(1)
X	pgrep -U ${%%APP_SHORTNAME%%_user} -f ${JBOSS_HOME}/modules > ${pidfile}
X	chown ${%%APP_SHORTNAME%%_user} $pidfile
X}
X
X%%APP_SHORTNAME%%_stop ()
X{
X	# Subvert the check_pid_file procname check.
X	if [ -f ${pidfile} ]
X	then
X		kill `cat ${pidfile}`
X		# Only if we aware that our setup can hangs, and only after trying simple kill, we can kill it hard way.
X		if [ ! -z "${%%APP_SHORTNAME%%_kill9}" ]
X		then
X			sleep ${%%APP_SHORTNAME%%_sleep}
X			kill  -9 `cat ${pidfile}`
X		fi
X		# In some setups, JBoss can spawn some child processess, which could prevent it from stopping, and freeing net ports.
X		# Let's blindly kill them all, since we are really know what we are doing.
X		if [ ! -z "${%%APP_SHORTNAME%%_additional_killall}" ]
X		then
X			sleep ${%%APP_SHORTNAME%%_sleep}
X			killall ${%%APP_SHORTNAME%%_additional_killall}
X		fi
X	fi
X}
X
Xrun_rc_command "$1"
a192e971ca37e5168d8ee2a7f5ff7f28
exit



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304251300.r3PD0jxj004473>