shutdown.sh 1.1 KB
#!/bin/bash

#
# Copyright (c) 2001-2019 kingtroldata, Ltd.
# All rights reserved.
#
# author: liyuanyuan (mailto:yuanyuan.li@kingtroldata.com)
#

## resolve links
PRG="$0"

# need this for relative symlinks
while [ -h "$PRG" ] ; do
  ls=`ls -ld "$PRG"`
  link=`expr "$ls" : '.*-> \(.*\)$'`
  if expr "$link" : '/.*' > /dev/null; then
    PRG="$link"
  else
    PRG="`dirname "$PRG"`/$link"
  fi
done

saveddir=`pwd`

SKRECEIVE_COMPONENT_HOME=`dirname "$PRG"`/..

# make it fully qualified
SKRECEIVE_COMPONENT_HOME=`cd "$SKRECEIVE_COMPONENT_HOME" && pwd`

cd "$saveddir"


SERVICE_NAME=skreceive

export MODE=service
export PID_FOLDER="${SKRECEIVE_COMPONENT_HOME}"/logs
export LOG_FOLDER="${SKRECEIVE_COMPONENT_HOME}"/logs
export identity=${SERVICE_NAME}
# export CONF_FOLDER="${SKRECEIVE_COMPONENT_HOME}"/conf

# If exists private jdk
if [ -d "${SKRECEIVE_COMPONENT_HOME}/jdk" ] || [ -h "${SKRECEIVE_COMPONENT_HOME}/jdk" ] || [ -L "${SKRECEIVE_COMPONENT_HOME}/jdk" ]; then
	export JAVA_HOME="${SKRECEIVE_COMPONENT_HOME}/jdk"
fi

RECEIVE_JAR=`echo "${SKRECEIVE_COMPONENT_HOME}"/*.jar`
if [ ! -x "${RECEIVE_JAR}" ]; then
  chmod + "${RECEIVE_JAR}"
fi

$RECEIVE_JAR stop "$@"