aboutsummaryrefslogtreecommitdiff
path: root/www/orion/files/orionctl
diff options
context:
space:
mode:
Diffstat (limited to 'www/orion/files/orionctl')
-rw-r--r--www/orion/files/orionctl40
1 files changed, 30 insertions, 10 deletions
diff --git a/www/orion/files/orionctl b/www/orion/files/orionctl
index eb1114d1cc0c..d6325382f82e 100644
--- a/www/orion/files/orionctl
+++ b/www/orion/files/orionctl
@@ -91,20 +91,27 @@ app() {
start() {
# Make sure the application is not started previously
- if [ -e %%PID_FILE%% ]; then
- error "Found %%APP_TITLE%% PID file at %%PID_FILE%%. It is probably already running."
+ 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
- # Create the process ID file
- rm -f %%PID_FILE%%
- touch %%PID_FILE%%
- chown %%USER_NAME%%:%%GROUP_NAME%% %%PID_FILE%%
+ # 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
}
@@ -120,12 +127,25 @@ stop() {
checks
# Kill the running program
- if [ ! -e %%PID_FILE%% ]; then
- error "Unable to find %%APP_TITLE%% PID file at %%PID_FILE%%. It is probably not running."
+ if [ ! -s %%PID_FILE%% ]; then
+ error "%%APP_TITLE%% is probably not running. The PID file at %%PID_FILE%% is empty."
exit 16
fi
- /bin/kill `cat %%PID_FILE%%`
- rm -f %%PID_FILE%%
+ 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
}