当前位置:网站首页>[implemented] server jar package startup script and shell script
[implemented] server jar package startup script and shell script
2022-06-30 07:09:00 【A rookie is a great God】
#!/bin/bash
# This can be replaced with your own execution program , The rest of the code doesn't need to change
APP_NAME=tmall.jar
LOG_NAME=tamll.log
# Instructions , Used to prompt for input parameters
usage() {
echo "Usage: sh start.sh [start|stop|restart|status]"
exit 1
}
# Check if the program is running
is_exist() {
pid=`ps -ef | grep $APP_NAME | grep -v grep | awk '{print $2}' `
# Returns if none exists 1, There is returned 0
if [ -z "${pid}" ]; then
return 1
else
return 0
fi
}
# Starting method
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 party
stop() {
is_exist
if [ $? -eq "0" ]; then
kill -9 $pid
else
echo "${APP_NAME} is not running"
fi
}
# Output running state
status() {
is_exist
if [ $? -eq "0" ]; then
echo "${APP_NAME} is running. Pid is ${pid}"
else
echo "${APP_NAME} is not running."
fi
}
# restart
restart() {
stop
start
}
# According to the input parameters , Select the corresponding method to execute , Without input, the instructions are executed
case "$1" in
"start")
start
;;
"stop")
stop
;;
"status")
status
;;
"restart")
restart
;;
*)
usage
;;
esac
边栏推荐
- Record common problems: spaces in encodeuricomponent decoding and the use of Schema in third-party apps to invoke apps
- Finished product upgrade procedure
- 【每日一题】535. TinyURL 的加密与解密
- Install the components corresponding to setup
- [Hot100]10. Regular Expression Matching
- What if I don't know what to do after graduating from university?
- Google Earth Engine(GEE)——墨累全球潮汐湿地变化 v1 (1999-2019) 数据集
- Record one time of Tencent Test Development Engineer's automation interface test practice experience
- Install go language development tools
- Servlet principle
猜你喜欢

Vs2019 and SQL

Skillfully use 5 keys to improve office efficiency

B站首个UP主付费观看视频还是来了!价格“劝退”网友

leetcode:98. 验证二叉搜索树

Linux server installation redis

Realization of dissolve effect in unity and its principle analysis

oracle数据库报列表中最大表达式为1000错误

0 basic job transfer software test, how to achieve a monthly salary of 9.5k+

解决:div获取不到键盘事件

Relevant database questions.
随机推荐
Essence of signal slot macros signal and slot
Four great happenings on earth
Write and run the first go language program
failed to create symbolic link ‘/usr/bin/mysql’: File exists
Go installation and configuration (1)
vs2019和sql
Performance comparison of random network, scale-free network, small world network and NS small world matlab simulation
【docsify基本使用】
如果我在珠海,到哪里开户比较好?另外,手机开户安全么?
JS create PDF file
First line of code (Third Edition) learning notes
June 29, 2022 -- take the first step with C # -- add decision logic to the code using the "if", "else" and "else if" statements in C #
Linu基础-分区规划与使用
Develop common dependency Libraries
Linux服務器安裝Redis
Egret P2 pit encountered by physical engine (1)
JS widget wave JS implementation of wave progress bar animation style
What if I forget my account number after opening an account? Is it safe to open an account online?
Egret P2 physical engine (1) small ball falling demo
Linu foundation - zoning planning and use