diff options
Diffstat (limited to 'java/jboss71/files/jboss71.in')
-rw-r--r-- | java/jboss71/files/jboss71.in | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/java/jboss71/files/jboss71.in b/java/jboss71/files/jboss71.in new file mode 100644 index 000000000000..268c29a38934 --- /dev/null +++ b/java/jboss71/files/jboss71.in @@ -0,0 +1,62 @@ +#!/bin/sh +# +# %%APP_SHORTNAME%% startup script. +# +# $FreeBSD$ +# + +# PROVIDE: %%APP_SHORTNAME%% +# REQUIRE: NETWORKING SERVERS + +# Add the following lines to /etc/rc.conf to enable %%APP_SHORTNAME%%: +# %%APP_SHORTNAME%%_enable (bool): Set to "YES" to enable %%APP_SHORTNAME%% +# %%APP_SHORTNAME%%_jvm_opts (str): Extra JVM flags. +# %%APP_SHORTNAME%%_args (str): Optional arguments to JBoss +# %%APP_SHORTNAME%%_logging (str) JBoss log output. A pipe command may be used. +# + +. /etc/rc.subr + +%%APP_SHORTNAME%%_user="%%USER%%" +%%APP_SHORTNAME%%_logdir="%%LOG_DIR%%" + +name="%%APP_SHORTNAME%%" +rcvar=%%APP_SHORTNAME%%_enable + +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"}" + +start_cmd="%%APP_SHORTNAME%%_start" +stop_cmd="%%APP_SHORTNAME%%_stop" +pidfile="%%PID_FILE%%" + +JBOSS_HOME="%%APP_HOME%%" + +%%APP_SHORTNAME%%_start () +{ + if [ ! -d "${%%APP_SHORTNAME%%_logdir}" ] + then + mkdir -p ${%%APP_SHORTNAME%%_logdir} + chown ${%%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) + pgrep -U ${%%APP_SHORTNAME%%_user} -f ${JBOSS_MAIN} > ${pidfile} + chown ${%%APP_SHORTNAME%%_user} $pidfile +} + +%%APP_SHORTNAME%%_stop () +{ + # Subvert the check_pid_file procname check. + if [ -f ${pidfile} ] + then + kill `cat ${pidfile}` + fi +} + +run_rc_command "$1" |