-
Notifications
You must be signed in to change notification settings - Fork 518
/
72crm.sh
42 lines (35 loc) · 1.06 KB
/
72crm.sh
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
38
39
40
41
42
#!/bin/bash
COMMAND="$1"
if [[ "$COMMAND" != "start" ]] && [[ "$COMMAND" != "stop" ]] && [[ "$COMMAND" != "restart" ]]; then
echo "Usage: $0 start | stop | restart"
exit 0
fi
APP_BASE_PATH=$(cd `dirname $0`; pwd)
function start()
{
# -Xms分配堆最小内存,默认为物理内存的1/64;-Xmx分配最大内存,默认为物理内存的1/4 如果程序会崩溃请将此值调高
nohup java -jar ${JAVA_OPTS} ${project.artifactId}-${project.version}.jar >> /dev/null 2>&1 &
echo "--------项目启动成功--------"
echo "--------欢迎使用悟空CRM ^_^--------"
}
function stop()
{
P_ID=`ps -ef | grep -w ${project.artifactId}-${project.version}.jar | grep -v "grep" | awk '{print $2}'`
kill $P_ID
echo "项目已关闭"
}
function restart()
{
P_ID=`ps -ef | grep -w ${project.artifactId}-${project.version}.jar | grep -v "grep" | awk '{print $2}'`
start
sleep 25s
kill $P_ID
echo "项目重启成功"
}
if [[ "$COMMAND" == "start" ]]; then
start
elif [[ "$COMMAND" == "stop" ]]; then
stop
else
restart
fi