PEAT Online Course -
How To Improve Your Personal Performance in Java work Technology

  • YOU + CONTROL
  • Focus
  • Autonomy
  • Proficiency
  • Purpose
  • Covid-19!!!
  • Deep Hidden Meaning
  • FREE updates
GET 75% OFF NOW
Your Promo code: TECHLAYOFF
Exclusively on
VIMEO ON-DEMAND

WildFly System V Initial Script

09 April 2014 Comments off

2 minutes

294

Originally drafted on 21 February 2014

Here is WildFly application serverSystem V Initial Script that I quickly put together for a Centos 6 virtual machine.
Use it at your own risk, don’t call me if something goes wrong, because I assume that you are an experienced Web Ops (web operations) or Sys Admin (system administrator) and you definitely know what you are doing.

Here goes cat /etc/init.d/wildfly.sh:

#!/bin/bash

: ${JAVA_HOME:=/usr/lib/jvm/jdk-7u51}
export JAVA_HOME

: ${SCALA_HOME:=/opt/scala-2.10.2}
export SCALA_HOME

PROC_LOCATION=/opt/wildfly-8.0.0.Final
PROC_NAME='WildFly App Server'
PROC_USER=wildfly
PROC_APP=wildfly
SLEEPTIME=8

export WILDFLY_HOME=${PROC_LOCATION}

# for multi instances adapt those lines.
TMP_DIR=/var/tmp
PID_FILE=/var/run/${PROC_APP}.pid

PREFIX_CMD=
## PREFIX_CMD='echo =>'

SUDO_CMD=/usr/bin/sudo

case "$1" in
  start)
    echo "Starting service ${PROC_NAME}"
    ${PREFIX_CMD} mkdir -p /var/log/${PROC_APP}
    ${PREFIX_CMD} chown -R ${PROC_USER} /var/log/${PROC_APP}
    ${PREFIX_CMD} ${SUDO_CMD} -u ${PROC_USER} -E ${WILDFLY_HOME}/bin/standalone.sh  >> /var/log/${PROC_APP}/${PROC_APP}.log  &
    exit $?
    ;;

  stop)
    echo "Stopping service ${PROC_NAME}"
    ProcessId=`ps auwwx | grep -v awk | awk '/'${PROC_USER}'/ && /org.jboss.as.standalone/ { print $2 }'`
    ${PREFIX_CMD} kill ${ProcessId}
    exit $?
    ;;

  restart)
    $0 stop
    echo "Zzz ... $SLEEPTIME secs"
    sleep $SLEEPTIME
    $0 start
    ;;

  probe|status)
    ProcessId=`ps auwwx | grep -v awk | awk '/'${PROC_USER}'/ && /org.jboss.as.standalone/ { print $0 }'`
    if [ "x${ProcessId}" != "x" ]; then
        echo $ProcessId
    else
        echo "No process is running."
    fi
    ;;

  *)
    echo "Usage: $0   start | stop | restart | probe | status"
    exit 1
    ;;

esac

#End
Hey all! Thanks for visiting. I provide fringe benefits to interested readers: checkout consultancy, training or mentorship Please make enquiries by email or
call +44 (0)7397 067 658.

Due to the Off-Payroll Working plan for the UK government, I am enforcing stricter measures on contracts. All potential public sector GOV.UK contracts engagements must be approved by QDOS and/or SJD Accounting. Please enquire for further information.