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

jdapp-launcher.0.0.3.source-code.jdapp-launcher.sh.example Maven / Gradle / Ivy

#!/usr/bin/env bash

JAVA_CMD="java"
CPATH="./:lib/*:./:services/*"
ID="1"
if [ "x$2" != "x" ]
then 
	ID="$2";
fi

CFG_PATH="conf/"
APPNAME=`cat "${CFG_PATH}application.jdapp"`
PIDFILE="${CFG_PATH}jdapp-daemon${ID}.pid"
DUBBO_CFG="dubbo.properties.file=${CFG_PATH}dubbo.properties"
LOG4J_CFG="log4j.configuration=${CFG_PATH}log4j.properties"

case $1 in
start)
    echo "Starting Server ${APPNAME}@${ID}..."
	if [ -f "$PIDFILE" ]; then
      if kill -0 `cat "$PIDFILE"` > /dev/null 2>&1; then
         echo $command already running as process `cat "$PIDFILE"`. 
         exit 0
      fi
    fi
	${JAVA_CMD} -cp ${CPATH} -server -D${DUBBO_CFG} -D${LOG4J_CFG} cn.zhucongqi.server.Main ${ID} &
	;;
stop)
	echo "Stoping Server ${APPNAME}@${ID}..."
	if [ ! -f "$PIDFILE" ]
    then
      echo "no server to stop (could not find file $PIDFILE)"
    else
		kill `cat "$PIDFILE"`
		rm "$PIDFILE"
		echo "The Server ${APPNAME}@${ID} stoped!"
	fi
	exit 0
	;;
*)
    echo "Usage: $0 {start|stop} [server_id=1] [debug|release]" 
    ;;
esac




© 2015 - 2025 Weber Informatics LLC | Privacy Policy