In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how jenkins implements shell scripting and regular execution of tasks. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
1. To develop an auction auction jar package service that requires a socket connection to update and restart, cut off the nginx access request half an hour before restart.
After the socket initiates the request, the interaction can be disconnected without nginx, but the task of socket will cause problems when auction is restarted before the end of the auction auction task.
The solution to access is to remotely push the jar to the production server after the jenkins is built, exit the background ahead of time to execute the server remote script, and the script cuts off the nginx proxy auction sleep 1800s through ngnx in advance, and restarts the update half an hour later.
Specify the build directory to acquire sibling dependencies
In the #! / bin/bash # script, whenever there is a statement that is not true, exit and stop executing set-e sed-I 's/server 192.168.0.31:8090/#server 192.168.0.31 set 8090 / home/nginx.proxy/conf/nginx.conf/home/nginx.proxy/sbin/nginx-s reloadsleep 1800s # import the environment variable export jar_PATH=/data/webexport APP_PATH=/home/auction# to determine whether the old process exists. Kill killjar () {pid= `ps-ef | grep auction | grep java | awk'{print $2} '`echo "auction Id list: $pid" if ["$pid" = ""] then echo "no auction pid alive" else kill-9$ pid fi} # call function killjar # to determine whether the old jar packet exists If it exists, delete [- f $APP_PATH/auction-1.0-SNAPSHOT.jar] & &\ rm-rf $APP_PATH/auction-1.0-SNAPSHOT.jar # and update the latest jar package if [- f $jar_PATH/auction-1.0-SNAPSHOT.jar] Then mv $jar_PATH/auction-1.0-SNAPSHOT.jar $APP_PATHfi # restart cd $APP_PATH#nohup java-jar-Dspring.config.location=/home/auction/config/application.yml auction-1.0-SNAPSHOT.jar > / dev/null 2 > & 1&nohup java-jar auction-1.0-SNAPSHOT.jar > / dev/null 2 > & 1 & # sleep 10 seconds Wait for the java process to complete. Sleep 5s sed-I 's/#server 192.168.0.31:8090/server 192.168.0.31
This is the end of this article on "how jenkins implements shell scripted and timed tasks". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.