<commit_before>#!/bin/bash
# ======================================================================
# NAMI Tools 服务器管理工具
# ======================================================================

BACKGROUD="\033[37m"                            # echo 时的 背景颜色
FONTCOLOR="\033[33m"                            # echo 时的 字体颜色
END="\033[0m"                                   # echo 时的 结束标志
HOST="127.0.0.1"                                # 本机地址用于测试本机Tomcat是否已经启动完成
STATUS="200 301 302"                            # 定义正常访问返回的状态码
SCRIPT_NAME=$0                                  # 脚本绝对路径
START_STOP=$1                                   # 命令行第一个参数
URI=/download/logo.png

ROOT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
echo ${ROOT_DIR}

INSTALLATION_DIR=${ROOT_DIR}
TOMCAT_HOME=${INSTALLATION_DIR}/appserver/tomcat
NAMI_CATALINA_BASE=${INSTALLATION_DIR}/appserver/CATALINA_BASE

export CATALINA_HOME=${TOMCAT_HOME}
export CATALINA_BASE=${NAMI_CATALINA_BASE}

#echo "JAVA_HOME:		${JAVA_HOME}"
#echo "ANT_HOME:		${ANT_HOME}"
echo "CATALINA_BASE: ${CATALINA_BASE}"
echo "CATALINA_HOME: ${CATALINA_HOME}"

usage(){
    echo
    echo "Usage: ${SCRIPT_NAME} start|stop|restart|status"
    echo
    exit 1
}
# 判断命令行参数是否为空,如果为空，调用帮助提示函数
if [[ ${START_STOP} == "" ]]; then
    usage
fi

# 获取PID函数
getPID(){
	PID=$(ps -ef | grep -v 'grep' | grep "${RIVER_CATALINA_BASE}/conf/logging.properties" | awk '{print $2}')
}

# 得到端口
getPort(){
    PORT=`cat ${RIVER_CATALINA_BASE}/conf/server.xml | awk '/HTTP\/1.1/ {print $2}' | cut -d'"' -f2`
}

# 输出颜色
printColor(){
    echo -ne 		     "*********************************************************\n"
	echo -ne "${FONTCOLOR}****************** BPMT Tools Co.,Ltd ®©  ***************${END}\n"
	echo -ne 			 "*********************************************************\n"
	echo
}
# 输出正在启动Tomcat
printStart(){
    printColor
    echo -n "BPMT Tomcat is starting please wait ..."
	echo
}
# 输出正在停止Tomcat
printStop(){
    printColor
    echo "BPMT Tomcat is stopping,please wait ..."
	echo
}
# 输出Tomcat没有运行
printNotRun(){
    printColor
    echo "BPMT Tomcat is not running..."
	echo
}
# 输出Tomcat正在运行
printRunning(){
    printColor
    echo "BPMT Tomcat is running... PID: ${PID}"
	echo
}

# 输出Tomcat没有，试图启动Tomcat
printNotRunTryStart(){
    printColor
    echo "BPMT Tomcat is not running, trying start BPMT Tomcat."
	echo
}

# 输出端口被占用
printPortUsed(){
    printColor
    echo "Port: ${PORT} is used by other application, please check."
	echo<commit_msg>fixed service.sh<commit_after>#!/bin/bash
# ======================================================================
# NAMI Tools 服务器管理工具
# ======================================================================

BACKGROUD="\033[37m"                            # echo 时的 背景颜色
FONTCOLOR="\033[33m"                            # echo 时的 字体颜色
END="\033[0m"                                   # echo 时的 结束标志
HOST="127.0.0.1"                                # 本机地址用于测试本机Tomcat是否已经启动完成
STATUS="200 301 302"                            # 定义正常访问返回的状态码
SCRIPT_NAME=$0                                  # 脚本绝对路径
START_STOP=$1                                   # 命令行第一个参数
URI=/download/logo.png

ROOT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
echo ${ROOT_DIR}

INSTALLATION_DIR=${ROOT_DIR}
TOMCAT_HOME=${INSTALLATION_DIR}/appserver/tomcat
NAMI_CATALINA_BASE=${INSTALLATION_DIR}/appserver/CATALINA_BASE

export CATALINA_HOME=${TOMCAT_HOME}
export CATALINA_BASE=${NAMI_CATALINA_BASE}

#echo "JAVA_HOME:		${JAVA_HOME}"
#echo "ANT_HOME:		${ANT_HOME}"
echo "CATALINA_BASE: ${CATALINA_BASE}"
echo "CATALINA_HOME: ${CATALINA_HOME}"

usage(){
    echo
    echo "Usage: ${SCRIPT_NAME} start|stop|restart|status"
    echo
    exit 1
}
# 判断命令行参数是否为空,如果为空，调用帮助提示函数
if [[ ${START_STOP} == "" ]]; then
    usage
fi

# 获取PID函数
getPID(){
	PID=$(ps -ef | grep -v 'grep' | grep "${NAMI_CATALINA_BASE}/conf/logging.properties" | awk '{print $2}')
}

# 得到端口
getPort(){
    PORT=`cat ${NAMI_CATALINA_BASE}/conf/server.xml | awk '/HTTP\/1.1/ {print $2}' | cut -d'"' -f2`
}

# 输出颜色
printColor(){
    echo -ne 		     "*********************************************************\n"
	echo -ne "${FONTCOLOR}****************** NAMI Server Management  **************${END}\n"
	echo -ne "${FONTCOLOR}****************** Born for Wechat Applet  **************${END}\n"
	echo -ne 			 "*********************************************************\n"
	echo
}
# 输出正在启动Tomcat
printStart(){
    printColor
    echo -n "NAMI Tomcat is starting please wait ..."
	echo
}
# 输出正在停止Tomcat
printStop(){
    printColor
    echo "NAMI Tomcat is stopping,please wait ..."
	echo
}
# 输出Tomcat没有运行
printNotRun(){
    printColor
    echo "NAMI Tomcat is not running..."
	echo
}
# 输出Tomcat正在运行
printRunning(){
    printColor
    echo "NAMI Tomcat is running... PID: ${PID}"
	echo
}

# 输出Tomcat没有，试图启动Tomcat
printNotRunTryStart(){
    printColor
    echo "BPMT Tomcat is not running, trying start BPMT Tomcat."
	echo
}

# 输出端口被占用
printPortUsed(){
    printColor
    echo "Port: ${PORT} is used by other application, please check."
	echo
{'fraction_non_alphanumeric': 0.24218283210515834, 'fraction_numerical': 0.015136427006572396, 'mean_word_length': 3.1538461538461537, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7040588', 'n_tokens_mistral': 1994, 'n_tokens_neox': 1918, 'n_words': 365}