Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to restart a project with a Shell script

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to restart a project with Shell script". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to restart a project with Shell script".

After each package, you need to restart the project manually. Write a Shell script to restart the project with one click.

Shell script #! / bin/bash while getopts "nargdo case p:" argdo case $arg in n) echo "NAME's arg:$OPTARG" NAME=$OPTARG;; p) echo "PORT's arg:$OPTARG" PORT=$OPTARG;; esacdonePROCESS=echo | lsof-I TCP:$PORT | grep LISTEN | awk'{print $2}'if [$PROCESS] Thenkill-9$ PROCESSecho kill $NAME:$PROCESS, restartficd jenkinscp jar/.tmp/$NAME-0.0.1-SNAPSHOT.jar jar/nohup java-jar-Xms128m-Xmx256m jar/$NAME-0.0.1-SNAPSHOT.jar-- eureka.url= "127.0.0.1:9100/eureka/"-- profile= "dev" > logs/$NAME.log 2 > & 1 & echo $NAME startingShell

Getopts: implementing multiple parameters for Shell scripts

Nohup: start the project in the background

Shell runs sh-n project-p 8080 thank you for reading, above is the content of "how to restart the project with Shell script". After the study of this article, I believe you have a deeper understanding of how to restart the project with Shell script, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report