当前位置:网站首页>优秀的jar包启动shell脚本收藏
优秀的jar包启动shell脚本收藏
2022-07-17 20:48:00 【qq_42582773】
#!/usr/bin/env bash
#jar包名称
server_name="service-switch-0.0.1-SNAPSHOT"
log_name="service-switch"
status() {
if [[ -n $(ps -ef | grep -v grep | grep ${
server_name} | sed -n '1P' | awk '{print $2}') ]]; then
echo -e "\033[36m ##: 正常运行中~ \033[0m"
else
echo -e "\033[31m 已经停止 \033[0m"
fi
}
start() {
export SW_AGENT_INSTANCE_NAME=${log_name}
export SW_AGENT_NAME=${server_name}
if [[ -z $(ps -ef | grep -v grep | grep ${
server_name} | sed -n '1P' | awk '{print $2}') ]]; then
# 停止了
nohup java -javaagent:/home/skywalking/skywalking-agent/skywalking-agent.jar -jar ${server_name}'.jar' >>${log_name}'.log' &
if [[ -n $(ps -ef | grep -v grep | grep ${
server_name} | sed -n '1P' | awk '{print $2}') ]]; then
echo -e "\033[36m ##: 启动成功~ \033[0m"
tail -f ${log_name}'.log'
else
echo -e "\033[31m 启动失败 \033[0m"
fi
else
echo -e "\033[32m ##: 服务已经在运行中... \033[0m"
fi
}
stop() {
ps -ef | grep -v grep | grep ${server_name} | sed -n '1P' | awk '{print $2}' | xargs kill -9
if [[ -z $(ps -ef | grep -v grep | grep ${
server_name} | sed -n '1P' | awk '{print $2}') ]]; then
echo -e "\033[32m ##: 已停止... \033[0m"
fi
}
main() {
if [ ! -f ${server_name}".jar" ]; then
echo -e "\033[31m 当前目录不存在 ${server_name}.jar 文件 \033[0m"
else
# 存在文件
echo -e "\033[42;30m ###[ 控制台 ]### \033[0m"
echo -e "\033[32m 0. \033[0m 启动服务"
echo -e "\033[32m 1. \033[0m 停止服务"
echo -e "\033[32m 2. \033[0m 查看服务状态"
echo -e "\033[32m 3. \033[0m 重启服务"
read -p "请输入数字0-2的选项,回车确认: " choose
case $choose in
0)
start
;;
1)
stop
;;
2)
status
;;
3)
stop
start
;;
*)
echo -e "\033[31m 请输入合法的数字 \033[0m"
;;
esac
fi
}
main
边栏推荐
- Installation of Topy Library (topology optimization software)
- 版本通告|Apache Doris 1.1 Release 版本正式发布!
- Tencent cloud object storage operation process
- NO.6浮点数的表示与运算
- Silent AI: how does shengteng AI solve the problem of sign language learning with large models?
- Luogu p2422 good feeling solution
- 类3实践
- 全面解析C语言多媒体开源框架GStreamer
- 96. Different binary search trees
- Huawei technologies:jonathan Krolikowski | from design to deployment, zero contact deep reinforcement learning WLANs
猜你喜欢

CMAKE学习笔记

ping 命令还能这么玩?

FreeRTOS implementation of idle tasks and blocking delay

JVM性能优化

Importerror: DLL load failed while importing win32api: the specified program cannot be found.

A review of classical must see for Nonconvex Optimization Problems "from symmetry to geometry", University of Rochester, et al

贝塞尔曲线简单介绍

ShanDong Multi-University Training #3

A Classical Review of nonconvex optimization problems from Symmetry to Geometry, Rochester University, etc.

Redis源码与设计剖析 -- 1.简单动态字符串
随机推荐
非凸优化问题经典必看综述“从对称性到几何性”,罗切斯特大学等
函數初認識-下
Class 3 practice
Huawei wireless device configuration user CAC
What are the ways to realize load balancing?
[C language] introduction and implementation of mine sweeping [array and function]
华为无线设备配置动态负载均衡
How to quickly calculate the FID, is, sfid, precision, recall and other key evaluation indicators of the generated model?
Introduction:Multiple DataFrames
数据库的增删改查
Run through caffe resnet-50 network to realize image classification -- Based on Huawei cloud ai1s
009 面试题 SQL语句各部分的执行顺序
无声的AI:昇腾AI如何用大模型破解手语学习的难题?
【ACWing】2492. HH Necklace
手册不全,如何手工刨出TongWeb的监控信息?
Notes with a face value of 10exp (303)
NO.6浮点数的表示与运算
Ranking of mainstream ERP systems, comparison of mainstream ERP systems
洛谷:P4516 [JSOI2018] 潜入行动(树形dp、树上分组背包统计方案数)
负载均衡有哪几种实现方式?