当前位置:网站首页>【已实现】服务器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
边栏推荐
- SOC_ AHB_ SD_ IF
- Deep learning --- the weight of the three good students' scores (3)
- 【Mask-RCNN】基于Mask-RCNN的目标检测和识别
- 相关数据库问题提问。
- Ftplib+ tqdm upload and download progress bar
- [fuzzy neural network] mobile robot path planning based on Fuzzy Neural Network
- Joseph problem C language
- SOC project AHB_ SD_ Host controller design
- RT thread migration to s5p4418 (IV): thread synchronization
- Why does ETL often become ELT or even let?
猜你喜欢

How to set the hot deployment of idea web project

经纬恒润再次荣获PACCAR集团 10PPM 质量奖

【Mask-RCNN】基于Mask-RCNN的目标检测和识别
![[Hot100]回文子串 与 最长回文子串](/img/a5/10dec640f02023c4d55cb42e6309fb.png)
[Hot100]回文子串 与 最长回文子串

【我的OpenGL学习进阶之旅】关于OpenGL的着色器的向量和矩阵分类的访问方式: xyzw/rgba/stpq以及数组下标

IDEA import导入的类明明存在,却飘红?

1.6 - CPU composition

汇编语言学习一(有栈协程铺垫,32位寄存器和相关指令学习,未完待续06/29)

原来你是这样的数组,终于学会了

Bat usage details 2
随机推荐
SOC_AHB_SD_IF
MySQL中的InnoDB引擎
Four great happenings on earth
Solr search
ETL为什么经常变成ELT甚至LET?
[docsify basic use]
Introduction to programming ape (11) -- structure
Cmake post makefile:32: * * * missing separator Stop.
How to set the hot deployment of idea web project
Google Earth engine (GEE) - Murray global tidal wetland change V1 (1999-2019) data set
Servlet principle
MySQL Optimization: from more than ten seconds to 300 milliseconds
Relevant database questions.
C language: exercise 3
1.4 - fixed and floating point numbers
第一行代码(第三版)学习笔记
Definition and use of ROS topic messages
史上最全一句话木马
Fastapi learning Day1
手机开户一般哪个证券公司好?还有,在线开户安全么?