当前位置:网站首页>【已实现】服务器jar包启动脚本、shell脚本
【已实现】服务器jar包启动脚本、shell脚本
2022-06-30 06:56:00 【菜鸟是大神】
#!/bin/bash
#这里可替换为你自己的执行程序,其他代码无需更改
APP_NAME=tmall.jar
LOG_NAME=tamll.log
#使用说明,用来提示输入参
usage() {
echo "Usage: sh start.sh [start|stop|restart|status]"
exit 1
}
#检查程序是否在运行
is_exist() {
pid=`ps -ef | grep $APP_NAME | grep -v grep | awk '{print $2}' `
#如果不存在返回1,存在返回0
if [ -z "${pid}" ]; then
return 1
else
return 0
fi
}
#启动方法
start() {
is_exist
if [ $? -eq "0" ]; then
echo "${APP_NAME} is already running. pid=${pid} ."
else
nohup java -jar /home/Tmall_demo/webapps/$APP_NAME > /home/Tmall_demo/logs/$LOG_NAME 2>&1 &
fi
}
#停止方
stop() {
is_exist
if [ $? -eq "0" ]; then
kill -9 $pid
else
echo "${APP_NAME} is not running"
fi
}
#输出运行状态
status() {
is_exist
if [ $? -eq "0" ]; then
echo "${APP_NAME} is running. Pid is ${pid}"
else
echo "${APP_NAME} is not running."
fi
}
#重启
restart() {
stop
start
}
#根据输入参数,选择执行对应方法,不输入则执行使用说明
case "$1" in
"start")
start
;;
"stop")
stop
;;
"status")
status
;;
"restart")
restart
;;
*)
usage
;;
esac
边栏推荐
- CPU到底是怎么识别代码的?
- [transfer] analysis of memory structure, cache and DMA architecture
- 15 minutes learn to use JWT
- tomorrow! "Mobile cloud Cup" competition air publicity will start!
- 【Mask-RCNN】基于Mask-RCNN的目标检测和识别
- Rising posture series: fancy debugging information
- sscanf 函数的使用
- How to set the hot deployment of idea web project
- RT thread migration to s5p4418 (III): static memory pool management
- 安装Go语言开发工具
猜你喜欢

Fastapi learning Day1

原理:WebMvcConfigurer 与 WebMvcConfigurationSupport避坑指南

Google Earth engine (GEE) - Murray global tidal wetland change V1 (1999-2019) data set

6、 Shopping ⻋ and orders

MySQL优化:从十几秒优化到三百毫秒

tomorrow! "Mobile cloud Cup" competition air publicity will start!

Assembly language learning I (with stack co process, 32-bit registers and related instructions, to be continued 06/29)

记录一次腾讯测试开发工程师自动化接口测试实践经验

第一行代码(第三版)学习笔记
![[mask RCNN] target detection and recognition based on mask RCNN](/img/80/f3db990b4f242609679d872b0dfe00.png)
[mask RCNN] target detection and recognition based on mask RCNN
随机推荐
[transfer] analysis of memory structure, cache and DMA architecture
【每日一题】535. TinyURL 的加密与解密
SOC_ AHB_ SD_ IF
[Hot100]10. Regular Expression Matching
Problems and solutions of creating topic messages in ROS
Write a C program to judge whether the system is large end byte order or small end byte order
1.9 - Classification of memory
sscanf 函数的使用
ROS system problem: rosdep init
Traverse map
[hot100] palindrome substring and longest palindrome substring
ROS-URDF
Deep learning --- the weight of the three good students' scores (3)
Linu基础-分区规划与使用
SOC项目AHB_SD_HOST控制器设计
SOC_ SD_ CLK
【Mask-RCNN】基于Mask-RCNN的目标检测和识别
【Hot100】15. Sum of three numbers
JS widget wave JS implementation of wave progress bar animation style
安装Go语言开发工具