linux_java_同时启动三个项目脚本
test.sh
--------------------------------------------------------------------------------------------------------------------------------------
#!/bin/sh
while :
do
run1=$(ps -ef |grep 'sxnx-sms-8081' |grep -v "grep")
run2=$(ps -ef |grep 'sxnx-sms-8082' |grep -v "grep")
run3=$(ps -ef |grep 'sxnx-sms-8083' |grep -v "grep")
if [ "$run1" ] ; then
echo "The sxnx-sms-8081 service is alive!"
else
echo "The sxnx-sms service was shutdown!"
echo "Starting service sxnx-sms-8081..."
nohup java -jar $PWD/sxnx-sms-8081.jar&
echo "The service sxnx-sms-8081 was started!"
fi
if [ "$run2" ] ; then
echo "The sxnx-sms-8082 service is alive!"
else
echo "The sxnx-sms service was shutdown!"
echo "Starting service sxnx-sms-8082..."
nohup java -jar $PWD/sxnx-sms-8082.jar&
echo "The service sxnx-sms-8082 was started!"
fi
if [ "$run3" ] ; then
echo "The sxnx-sms-8083 service is alive!"
else
echo "The sxnx-sms service was shutdown!"
echo "Starting service sxnx-sms-8083..."
nohup java -jar $PWD/sxnx-sms-8083.jar&
echo "The service sxnx-sms-8083 was started!"
fi
sleep 10
done
=======================================================================================================================
去掉while循环,只执行一次
#!/bin/sh
run1=$(ps -ef |grep 'sxnx-sms-8081' |grep -v "grep")
run2=$(ps -ef |grep 'sxnx-sms-8082' |grep -v "grep")
run3=$(ps -ef |grep 'sxnx-sms-8083' |grep -v "grep")
if [ "$run1" ] ; then
echo "The sxnx-sms-8081 service is alive!"
else
echo "The sxnx-sms service was shutdown!"
echo "Starting service sxnx-sms-8081..."
nohup java -jar $PWD/sxnx-sms-8081.jar&
echo "The service sxnx-sms-8081 was started!"
fi
if [ "$run2" ] ; then
echo "The sxnx-sms-8082 service is alive!"
else
echo "The sxnx-sms service was shutdown!"
echo "Starting service sxnx-sms-8082..."
nohup java -jar $PWD/sxnx-sms-8082.jar&
echo "The service sxnx-sms-8082 was started!"
fi
if [ "$run3" ] ; then
echo "The sxnx-sms-8083 service is alive!"
else
echo "The sxnx-sms service was shutdown!"
echo "Starting service sxnx-sms-8083..."
nohup java -jar $PWD/sxnx-sms-8083.jar&
echo "The service sxnx-sms-8083 was started!"
fi
相关文章
- Java学习之java高级特性
- linux安装MAT(MemoryAnalyzerTool),并且分析java dump的方法
- linux,shell中if else if的写法,if elif
- 在java中使用JMH(Java Microbenchmark Harness)做性能测试
- Linux系统:常用Linux系统管理命令总结
- Java if判断对象为null时,null放在比较运算符的左边还是右边?哪种才是java标准?进来看看你就知道了
- Java项目(前端vue后台java微服务)在线考试系统(java+vue+springboot+mysql+maven)
- Java详解,java后端应届生面试题
- Linux下 git 上传与删除 的基本指令
- 用navicat访问linux数据库,成功实现Navicat访问Linux中安装的MySQL数据库
- Linux安装Tomcat
- Linux /proc/kcore详解(二)
- Java学习-050-AES256 之 java.security.InvalidKeyException: Illegal key size or default parameters 解决方法
- linux java中使用POI将word转为PDF时无法显示文字
- Java .class 反编译 Luyten,导出 .java文件,查看jar 包目录,超级简单,实用
- Linux网络配置
- Linux_查看linux并发连接数
- 『Java练习生的自我修养』java-se进阶⁵ • 常用IO流
- 【嵌入式Linux驱动开发】二十、一文快速上手 Linux INPUT 子系统,按键驱动的第三种姿势
- 【深入JAVA】java注解
- Linux 之 arm linux 与 windows 使用 tftp 进行文件传输的简单整理
- linux下java 调用 c jni 实现 HelloWorld
- C#读取文件或者字符流的最后几行,类似linux的tail命令-OK
- 涵盖了 Java、Qt、AI、R 语言以及 Linux 学习的学习类开源项目
- java项目异常监控_JAVA项目中的常用的异常处理情况总结