All Downloads are FREE. Search and download functionalities are using the official Maven repository.

act_scripts.run Maven / Gradle / Ivy

There is a newer version: 1.9.1
Show newest version
#!/bin/bash
APP_ENTRY=${app.entry}

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
BASE=$DIR/.
CP=$BASE/classes:$BASE/lib/*
CMD=$0
DEBUG=0
DEBUG_PORT=5005
PROFILE=$ACT_PROFILE
GROUP=$ACT_GROUP
SYS_PROP=$ACT_SYS_PROP
HELP=0
if [[ ! $JAVA_OPTS = *"-server"* ]]; then
        JAVA_OPTS="$JAVA_OPTS -server"
fi
if [[ ! $JAVA_OPTS = *"-Xms"* ]]; then
        JAVA_OPTS="$JAVA_OPTS -Xms${vmargs.heap.init}"
fi
if [[ ! $JAVA_OPTS = *"-Xmx"* ]]; then
        JAVA_OPTS="$JAVA_OPTS -Xmx${vmargs.heap.max}"
fi
if [[ ! $JAVA_OPTS = *"-XX:+HeapDumpOnOutOfMemoryError"* ]]; then
        JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError"
fi
if [[ ! $JAVA_OPTS = *"-Djava.awt.headless"* ]]; then
        JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true"
fi
# JAVA_OPTS="$JAVA_OPTS -server -Xms${vmargs.heap.init} -Xmx${vmargs.heap.max} -XX:MaxPermSize=128M ${vmargs.extended}"
# As long as there is at least one more argument, keep looping
while [[ $# -gt 0 ]]; do
    key="$1"
    case "$key" in
        # enable remote debugging with -d or --debug
        -d|--debug)
        DEBUG=1
        ;;
        # specify remote debug port with --debug-port=
        --debug-port)
        shift # past the key and to the value
        DEBUG_PORT="$1"
        ;;
        # specify the profile with -p or --profile
        -p|--profile)
        shift # past the key and to the value
        PROFILE="$1"
        ;;
        # specify any java system property
        -D*)
        SYS_PROP="$SYSPROP $1"
        ;;
        # specify node group
        -g|--group)
        shift # past the key and to the value
        GROUP="$1"
        ;;
        # help ?
        -h|--help)
        echo $CMD start the app
        echo ''
        echo '     -d --debug           enable remote debugging'
        echo '     --debug-port   specify debug port (if not specified then debug port is 5005)'
        echo '     -p --profile         specify the profile to start the app'
        echo '     -g --group           specify the node group'
        echo '     -Dprop=val           specify any JVM system properties'
        echo '     -h --help            display this help message'
        HELP=1
        ;;
        *)
        # Do whatever you want with extra options
        echo "Unknown option '$key'"
        ;;
    esac
    # Shift after checking all the cases to get the next option
    shift
done

if [[ HELP -gt 0 ]]; then
# don't run in help mode
    echo ''
else
    if [[ DEBUG -gt 0 ]]; then
        java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=$DEBUG_PORT $JAVA_OPTS -Dapp.mode=prod -Dapp.nodeGroup=$GROUP -Dprofile=$PROFILE $SYS_PROP -cp "$CP" $APP_ENTRY
    else
        java $JAVA_OPTS -Dapp.mode=prod -Dapp.nodeGroup=$GROUP -Dprofile=$PROFILE $SYS_PROP -cp "$CP" $APP_ENTRY
    fi
fi




© 2015 - 2024 Weber Informatics LLC | Privacy Policy