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

Share, secure, distribute, control, and monetize your APIs with the platform built with performance, time-to-value, and growth in mind. Free 90 day trial 3Scale by Red Hat

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

Discover how you can achielve enterpriese agility with microservices and API management

Topics:

Published at DZone with permission of Peter Pilgrim, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}