start.sh 931 Bytes
#conf
cp src/main/resources/application.properties.online src/main/resources/application.properties
cp src/main/resources/public/index.html.online src/main/resources/public/index.html

#path
project_path=$(cd `dirname $0`; cd ..; pwd)
log_path=${project_path}/log
pid_file=${project_path}/bin/pid
echo "INFO: project_path=${project_path}"
echo "INFO: log_path=${log_path}"
echo "INFO: pid_file=${pid_file}"

#mkdir log
if [ -d ${log_path} ];then
        echo "INFO: log/ exit"
else
        echo "INFO: log/ not exit,create path log/"
        mkdir ${log_path}
fi

# Check pid file
if [[ -f $pid_file ]]; then
    echo "Error: Service may be already started. Check the status first.";
    exit 1;
fi

# start
nohup mvn spring-boot:run >> ${log_path}/xkl.out &

# write down the pid
pid=$!;
if [[ -z $pid ]]; then
    echo "Error: cannot start the service."
    exit 1
fi
echo ${pid} > ${pid_file}
echo "INFO: start newstat service"