0%

Cloud Toolkit之Command编写指南

Cloud Toolkit 帮助开发者将本地应用程序一键部署到阿里云 ECS、EDAS 和 Kubernetes 和任意服务器中去。

Spring Boot 应用

5cde002f2d3b822696

start.sh

1
2
3
4
5
#!/bin/bash
knowledge_pwd=/home/jhuser/knowledge
cd $knowledge_pwd
echo starting
nohup jdk1.8.0_151/bin/java -jar knowledge-aggregator-1.0-SNAPSHOT.jar > nohup.out 2>&1 &

stop.sh

1
2
3
4
5
6
7
8
9
#!/bin/bash
PID=$(ps -ef | grep knowledge-aggregator-1.0-SNAPSHOT.jar | grep -v grep | awk '{ print $2 }')
if [ -z "$PID" ]
then
echo knowledge is already stopped
else
echo kill $PID
kill $PID
fi

restart.sh

1
2
3
4
5
#!/bin/bash
echo stop knowledge
source /home/jhuser/knowledge/stop.sh
echo start knowledge
source /home/jhuser/knowledge/start.sh

标准的 Java Web Tomcat 应用

5c41360fb210f5c41360fb210f

restart-tomcat.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash
echo "stop hug_interview....."
PID=$(ps -ef | grep tomcat_2.0/bin | grep -v grep | awk '{ print $2 }')
if [ -z "$PID" ]
then
echo hug_interview is already stopped
else
echo kill $PID
kill $PID
fi

echo "remove old hug_interview"
rm -rf /home/hug_interview/2.0/tomcat_2.0/webapps/hug_interview

echo "start hug_interview....."
sh /home/hug_interview/2.0/tomcat_2.0/bin/startup.sh