eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
Subject incubator-eagle git commit: [HOTFIX] Resolve eagle-server.sh
Date Mon, 19 Sep 2016 09:04:34 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 3706dc7e6 -> 02aab65b7


[HOTFIX] Resolve eagle-server.sh


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/02aab65b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/02aab65b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/02aab65b

Branch: refs/heads/master
Commit: 02aab65b722fbc9bce61ee21d8fd05b8165d012f
Parents: 3706dc7
Author: Hao Chen <hao@apache.org>
Authored: Mon Sep 19 17:02:36 2016 +0800
Committer: Hao Chen <hao@apache.org>
Committed: Mon Sep 19 17:03:49 2016 +0800

----------------------------------------------------------------------
 .../src/main/bin/eagle-server.sh                | 132 +++++++++++++++++++
 1 file changed, 132 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/02aab65b/eagle-server-assembly/src/main/bin/eagle-server.sh
----------------------------------------------------------------------
diff --git a/eagle-server-assembly/src/main/bin/eagle-server.sh b/eagle-server-assembly/src/main/bin/eagle-server.sh
new file mode 100644
index 0000000..975d2a7
--- /dev/null
+++ b/eagle-server-assembly/src/main/bin/eagle-server.sh
@@ -0,0 +1,132 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+function print_help() {
+	echo "Usage: $0 {start | stop | restart | status}"
+	exit 1
+}
+
+if [ $# != 1 ]
+then
+	print_help
+fi
+
+DIR=$(dirname $0)
+
+
+source ${DIR}/eagle-env.sh
+
+JVM_OPTS="-server -Xms1024m -Xmx1024m -XX:MaxPermSize=1024m"
+
+GC_OPTS="-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:${DIR}/../log/eagle-server-gc.log"
+
+if [ ! -z "$EAGLE_SERVER_JMX_PORT" ]; then
+    JMX_HOST=`hostname -f`
+    JVM_OPTS="-Dcom.sun.management.jmxremote \
+    -Dcom.sun.management.jmxremote.port=$EAGLE_SERVER_JMX_PORT \
+    -Dcom.sun.management.jmxremote.authenticate=false \
+    -Dcom.sun.management.jmxremote.ssl=false \
+    -Dcom.sun.management.jmxremote.local.only=false \
+    -Djava.rmi.server.hostname=$JMX_HOST \
+    -Dcom.sun.management.jmxremote.rmi.port=$EAGLE_SERVER_JMX_PORT \
+    $JVM_OPTS"
+fi
+
+JVM_OPTS="-Dconfig.resource=eagle.conf $JVM_OPTS $GC_OPTS"
+
+PIDFILE="${DIR}/../run/eagle-server.pid"
+
+CONFIGURATION_YML="${DIR}/../conf/server.yml"
+
+DEBUG_OPTIONS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
+
+PROGRAM="java $JVM_OPTS -cp $EAGLE_CLASSPATH org.apache.eagle.server.ServerMain server ${CONFIGURATION_YML}"
+
+cd $DIR/../
+
+if [ ! -e ${DIR}/../run ]; then
+    mkdir ${DIR}/../run;
+fi
+
+start() {
+    echo "Starting eagle service ..."
+	echo ${PROGRAM}
+	nohup ${PROGRAM} 1> ${DIR}/eagle-server.out & echo $! > $PIDFILE
+	if [ $? != 0 ];then
+		echo "Error: failed starting"
+		exit 1
+	fi
+}
+
+stop() {
+    echo "Stopping eagle service ..."
+	if [[ ! -f $PIDFILE ]];then
+	    echo "Eagle service is not running"
+    	exit 1
+    fi
+
+    PID=`cat $PIDFILE`
+	kill $PID
+	if [ $? != 0 ];then
+		echo "Error: failed stopping"
+		rm -rf ${PIDFILE}
+		exit 1
+	fi
+
+	rm ${PIDFILE}
+	echo "Stopping is completed"
+}
+
+case $1 in
+"start")
+    start;
+	;;
+"stop")
+    stop;
+	;;
+"restart")
+	echo "Restarting eagle service ..."
+    stop; sleep 1; start;
+	echo "Restarting is completed "
+	;;
+"status")
+	echo "Checking eagle service status ..."
+	if [[ -e ${PIDFILE} ]]; then
+	    PID=`cat $PIDFILE`
+	fi
+	if [[ -z ${PID} ]];then
+	    echo "Error: Eagle service is not running (missing PID)"
+	    exit 0
+	elif ps -p ${PID} > /dev/null; then
+	    echo "Eagle service is running with PID $PID"
+	    exit 0
+    else
+        echo "Eagle service is not running (tested PID: ${PID})"
+        exit 0
+    fi
+	;;
+*)
+	print_help
+	;;
+esac
+
+if [ $? != 0 ]; then
+	echo "Error: start failure"
+	exit 1
+fi
+
+exit 0
\ No newline at end of file


Mime
View raw message