springboot Jboss7脚本

启动脚本:

#!/bin/bash

#startup parameters
#JAVA_OPTS="-server -Xms400m -Xmx400m -Xmn300m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -Xverify:none -XX:+DisableExplicitGC -Djava.awt.headless=true"
JAVA_HOME=/xxx/xxxx

echo "Please input the jar path relative to the deployment directory('apps'), e.g. xxxx/xxxx.jar :"
read jar_path
jar_full_name=${jar_path##*/}
echo "jar_full_name = ${jar_full_name}"
jar_name=${jar_full_name%.*}
echo "jar_name = ${jar_name}"
parent_dir="/xxxxx"
log_dir="${parent_dir}/data/logs"
log_file="${log_dir}/${jar_name}.log"
echo "log_file = ${log_file}"
jar_file="${parent_dir}/apps/${jar_path}"
echo "jar_file = ${jar_file}"

# number of parameter is less than 1, interrupt
#if [ $# -lt 1 ] || [ -z $1 ]; then
#    echo -e "\033[31minput jar name end with .jar!\033[0m"
#    exit 1
#fi

#log file not exist, create
if [ ! -d "${log_dir}" ]; then
    mkdir "${log_dir}"
fi

if [ -f "${jar_file}" ]; then
    ${JAVA_HOME}/bin/java -jar -Dlogging.path=${log_file} ${jar_file} 1>/dev/null &
    exit 0
else
   echo "${jar_file} not exist!"
    exit 1
fi

停止脚本

#! /bin/csh -f

setenv JAVA_HOME /xxxx/xxxx
set JAVA       = "${JAVA_HOME}/bin/java"
set JAVA_OPTS  = "-Xms512m -Xmx512m"
echo "Please input the service name to stop:"
read service
kill -9 `ps -ef|grep "${service}.*" |grep -v grep|awk '{print $2}'`

你可能感兴趣的:(springboot Jboss7脚本)