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

Shell script sharing that kills the specified process and starts the specified jar package

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly explains "killing the specified process and starting the shell script sharing of the specified jar package". The explanation content in the article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian slowly and deeply to study and learn "killing the specified process and starting the shell script sharing of the specified jar package" together!

A shell script that kills a process kill_process.sh

#!/ bin/bash#kill_process.sh(kill process sh)current_PID=$$#ps -ef| grep "java" | grep -v "grep" | awk '{print $2}' > /tmp/${current_PID}.txtps -aux | grep "/usr/sbin/httpd" | grep -v "grep" | awk '{print $2}' > /tmp/${current_PID}.txtfor pid in `cat /tmp/${current_PID}.txt`do{ echo "kill -9 $pid" kill -9 $pid}donerm -f /tmp/${current_PID}.txt

shell script java_run.sh to start a jar package

pids=`ps -ef | grep "msger" | grep -v grep | awk '{print $2}'`if [ "$pids" = "" ] then # export LANG=zh_CN # export LC_ALL=zh_CN MSGER_HOME=/amp/msger PATH_SEPARATOR=: CP=$(ls $MSGER_HOME/lib/*.jar | \ paste -s -d"$PATH_SEPARATOR" - ) cd $MSGER_HOME java -Xms512m -Xmx512m -cp $CP:classes cn.com.msger.Msger& else echo "Msger is already start,pid is:$pies"fi Thank you for reading, the above is the content of "killing the specified process and starting the shell script sharing of the specified jar package". After learning this article, I believe that everyone has a deeper understanding of the problem of killing the specified process and starting the shell script sharing of the specified jar package. The specific use situation still needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

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