Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

WildFly System V Initial Script

DZone's Guide to

WildFly System V Initial Script

· Integration Zone ·
Free Resource

The new Gartner Critical Capabilities report explains how APIs and microservices enable digital leaders to deliver better B2B, open banking and mobile projects.

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

The new Gartner Critical Capabilities for Full Lifecycle API Management report shows how CA Technologies helps digital leaders with their B2B, open banking, and mobile initiatives. Get your copy from CA Technologies.

Topics:

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}