Alibaba Cloud Toolkit Command Writing Guide
This article provides the best practice for writing commands when you are using the Alibaba Cloud Toolkit plug-in to deploy the following applications:
- Standard Java Web Tomcat applications
- Standard Java Fatjar applications
- Standard Spring Boot applications
- Standard Go applications
Standard Java Web Tomcat Applications

As shown in the preceding figure, assume that the /root/tomcat/ in the Linux system is the root directory of a Tomcat application. We need to deploy the WAR package (javademo.war) of the Java Web application to the /root/tomcat/webapps directory.
The corresponding command configuration is as follows:
sh /root/sh/restart-tomcat.sh
The content of the restart-tomcat.sh script is as follows:
source /etc/profile
killall java
rm -rf /root/tomcat/webapps/javademo
sh /root/tomcat/bin/startup.sh
The /ect/profile file is used to configure environment variables, and contains content similar to the following:
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
export JAVA_HOME=/usr/share/jdk1.8.0_14
export PATH=$JAVA_HOME/bin:.....
Standard Java Fatjar Applications
Assume that the /root/javademo directory in the Linux system is used as the root directory of a Java application. We need to deploy the jar package of the Java application to the /root/javademo directory.
The corresponding command configuration is as follows:
sh /root/sh/restart-java.sh
The content of the restart-java.sh script is as follows:
source /etc/profile
killall java
nohup java -jar /root/javademo/javademo-0.0.1-SNAPSHOT.jar > nohup.log 2>&1 &
Standard Spring Boot Applications
Assume that the/root/springbootdemo directory of the Linux system is used as the root directory of a Spring Boot application. We need to deploy the jar package (springbootdemo-0.0.1-SNAPSHOT.jar) of the Spring Boot application to the /root/springbootdemo directory.
The corresponding command configuration is as follows:
sh /root/sh/restart-springboot.sh
The content of the restart-springboot.sh script is as follows:
source /etc/profile
killall java
nohup java -jar /root/springbootdemo/springbootdemo-0.0.1-SNAPSHOT.jar > nohup.log 2>&1 &
Standard Go Applications
Assume that the /root/godemo directory in the Linux system is used as the root directory of a Go application. We need to deploy the executable file (godemo) of the Go application to the /root/godemo directory.
The corresponding command configuration is as follows:
sh /root/sh/restart-go.sh
The content of the restart-go.sh script is as follows:
source /etc/profile
pkill -f 'godemo'
chmod 755 /root/godemo/godemo;
sh -c /root/godemo/godemo
Read previous post:
Deploying Applications to EDAS with Cloud Toolkit Maven Plug-in
Read next post:
Deploy Spring Boot or Spring Cloud Applications to Alibaba Cloud in Eclipse
Comments
Related Products
-
Robotic Process Automation (RPA)
Robotic Process Automation (RPA) allows you to automate repetitive tasks and integrate business rules and decisions into processes.
Learn More -
EDAS
A PaaS platform for a variety of application deployment options and microservices solutions to help you monitor, diagnose, operate and maintain your applications
Learn More -
Super App Solution for Telcos
Alibaba Cloud (in partnership with Whale Cloud) helps telcos build an all-in-one telecommunication and digital lifestyle platform based on DingTalk.
Learn More -
Alibaba Cloud for Manufacturing
Gain an industrial edge with Alibaba Cloud best practices
Learn More
More Posts by Nick(倪超)
- Deploy Spring Boot or Spring Cloud Applications to Alibaba Cloud in Eclipse
- Deploying Applications to EDAS with Cloud Toolkit Maven Plug-in
- Deploying a Node.js Application to an ECS Instance
- Deploying an Application to Container Service for Kubernetes
- Deploying a Go Application to an ECS Instance
- Deploying a Java Application to an ECS Instance in IntelliJ IDEA
- Deploy an Application to Alibaba Cloud EDAS in Eclipse
- Deploying a Java Application to an ECS Instance in Eclipse