diff options
Diffstat (limited to 'www/orion/files/orionctl')
-rw-r--r-- | www/orion/files/orionctl | 180 |
1 files changed, 0 insertions, 180 deletions
diff --git a/www/orion/files/orionctl b/www/orion/files/orionctl deleted file mode 100644 index d6325382f82e..000000000000 --- a/www/orion/files/orionctl +++ /dev/null @@ -1,180 +0,0 @@ -#!/bin/sh - -# Set some variables -APP_HOME=%%APP_HOME%% -STDOUT_LOG=%%STDOUT_LOG%% -STDERR_LOG=%%STDERR_LOG%% -JAR_FILE=${APP_HOME}/orion.jar -MYSELF=`basename $0` - -# Set the CLASSPATH -unset CLASSPATH -for i in ${APP_HOME}/lib/* ; do - if [ "$CLASSPATH" != "" ]; then - CLASSPATH=${CLASSPATH}:$i - else - CLASSPATH=$i - fi -done - -# Check if the JAVA_HOME directory is defined, otherwise set it to the -# fallback default -if [ "${JAVA_HOME}a" = "a" ]; then - JAVA_HOME=%%JAVA_HOME%% -fi -if [ -f ${JAVA_HOME}/lib/tools.jar ] ; then - CLASSPATH=${CLASSPATH}:${JAVA_HOME}/lib/tools.jar -fi -JAVA_CMD=${JAVA_HOME}/bin/java - - -############################################################################## -# Function that shows an error message -# -# This function is called by the 'checks' function -# -# Parameters: -# 1: The message to be displayed. - -error() { - echo -n "%%APP_SHORTNAME%%: ERROR: " - echo $1 -} - - -############################################################################## -# Function that performs all checks necessary for starting or stopping the -# application. -# -# This function is called by the 'start' and 'stop' functions -# -# This function expects no parameters - -checks() { - # Make sure the application directory does exist - if [ ! -d ${APP_HOME} ]; then - error "Unable to find %%APP_TITLE%% home directory at ${APP_HOME}." - exit 2 - fi - - # Make sure the application JAR file exists - if [ ! -r ${JAR_FILE} ]; then - error "Unable to find %%APP_TITLE%% JAR file at ${JAR_FILE}." - exit 3 - fi - - # Make sure the Java VM can be found - if [ ! -x ${JAVA_CMD} ]; then - error "Unable to find Java VM at ${JAVA_HOME}." - exit 4 - fi -} - - -############################################################################## -# Functions that calls the application with the specified parameter -# -# Parameters: -# 1: The argument to pass to the application (optional) - -app() { - (cd ${APP_HOME} && ${JAVA_CMD} -cp ${CLASSPATH} -jar ${JAR_FILE} $1 &) >> ${STDOUT_LOG} 2>> ${STDERR_LOG} -} - - -############################################################################## -# Function that starts the application -# -# This function is called from the main function -# -# This function expects no parameters - -start() { - # Make sure the application is not started previously - if [ -s %%PID_FILE%% ]; then - error "%%APP_TITLE%% is probably already running. The PID file at %%PID_FILE%% is not empty." - exit 1 - fi - - # Perform the checks that apply to stopping as well - checks - - # Fix the permissions for the PID file, just in case - chown %%USER%%:%%GROUP%% %%PID_FILE%% - chmod 600 %%PID_FILE%% - - # Start the application - echo -n ">> Starting %%APP_TITLE%%..." - (cd ${APP_HOME} && ${JAVA_CMD} -jar ${JAR_FILE} & echo $! > %%PID_FILE%%) >> ${STDOUT_LOG} 2>> ${STDERR_LOG} - if [ $? -eq 0 ]; then - echo " [ DONE ]" - else - echo " [ FAILED ]" - exit 13 - fi -} - - -############################################################################## -# Function that stops the application -# -# This function is called from the main function -# -# This function expects no parameters - -stop() { - # Perform the checks - checks - - # Kill the running program - if [ ! -s %%PID_FILE%% ]; then - error "%%APP_TITLE%% is probably not running. The PID file at %%PID_FILE%% is empty." - exit 16 - fi - PID=`cat %%PID_FILE%%` - echo -n ">> Killing %%APP_TITLE%% process (${PID})..." - /bin/kill ${PID} > /dev/null 2> /dev/null - if [ $? -eq 0 ]; then - echo " [ DONE ]" - else - echo " [ FAILED ]" - fi - echo -n ">> Emptying PID file (%%PID_FILE%%)..." - > %%PID_FILE%% 2> /dev/null - if [ $? -eq 0 ]; then - echo " [ DONE ]" - else - echo " [ FAILED ]" - fi -} - - -############################################################################## -# Main function. This function calls the 'start' and 'stop' functions. -# -# Parameters: -# 1: The argument to this shell script - -main() { - case "$1" in - start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - *) - echo "Usage: ${MYSELF} { start | stop | restart }" - exit 64 - ;; - esac -} - - -# Call the main function and exit -main $1 -exit 0 |