Start wildfly as service

9,498

There is a script to do this.

If you want to have a service available: from the script I would assume you need to do this:

WILDFLY_DIR=$INSTALL_DIR/wildfly
INSTALL_DIR=/opt
WILDFLY_USER="wildfly"
WILDFLY_SERVICE="wildfly"

....

echo "Registrating Wildfly as service..."
# if Debian-like distribution
if [ -r /lib/lsb/init-functions ]; then
    cp $WILDFLY_DIR/bin/init.d/wildfly-init-debian.sh /etc/init.d/$WILDFLY_SERVICE
    sed -i -e 's,NAME=wildfly,NAME='$WILDFLY_SERVICE',g' /etc/init.d/$WILDFLY_SERVICE
    WILDFLY_SERVICE_CONF=/etc/default/$WILDFLY_SERVICE
fi

Ie. copy /opt/wildfly/bin/init.d/wildfly-init-debian.sh over to /etc/init.d/wildfire. Change the /etc/init.d/wildfire and change the NAME to wildfly and the part of the script a bit down explains how to start it as a service so you could make your own service from it.

Share:
9,498
jan
Author by

jan

A Senior Development Engineer based in Mannheim, Germany.

Updated on September 18, 2022

Comments

  • jan
    jan over 1 year

    I installed wildfly on an ubuntu on a EC2 VM. I connect to the server via SSH and start the server with:

    ./standalone.sh --server-config=standalone-full.xml
    

    This works fine until I terminate the SSH connection. How can I start this as service so it stays active after closing the SSH connection. Did not find any working guide about that. Is there any easy way to do that?