start.sh
929 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#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"