-
Notifications
You must be signed in to change notification settings - Fork 0
/
startup.sh
69 lines (61 loc) · 1.45 KB
/
startup.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
#export JAVA_HOME=/usr/java/jdk1.7.0_25
##java -jar /var/lib/jenkins/workspace/example-maven-project/target/spring-data-fundamentals-1.0.0-SNAPSHOT.jar
checkpid()
{
echo $(ps -ef | grep "spring-data-fundamentals-1.0.0-SNAPSHOT.jar" | grep -v grep | awk '{ print $2}')
}
start ()
{
if [ $(checkpid) ] ; then
echo -e "\n$(date +%Y%m%d-%H:%M:%S) spring-data is running (pid:$(checkpid))\n"
else
echo ""
printf "$(date +%Y%m%d-%H:%M:%S) Spring data is starting..."
#cd /app/mservice/CBTK_new
nohup java -jar /tmp/spring-data-fundamentals-1.0.0-SNAPSHOT.jar > /dev/null 2>&1 &
fi
}
stop ()
{
if [ $(checkpid) ] ; then
kill -9 $(checkpid)
echo -e "\n$(date +%Y%m%d-%H:%M:%S) Spring stop success\n"
fi
}
status ()
{
if [ $(checkpid) ] ; then
echo -e "\n$(date +%Y%m%d-%H:%M:%S) Spring demo is running (pid:$(checkpid))\n"
else
echo -e "\n$(date +%Y%m%d-%H:%M:%S) Spring demo is not started\n"
fi
}
restart()
{
if [ $(checkpid) ] ; then
stop
sleep 2
start
else
echo -e "\n$(date +%Y%m%d-%H:%M:%S) Spring demo is not started\n"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status
;;
*)
echo -e "\nUsage: $0 {start|stop|status|restart|reload}\n"
exit 1
;;
esac