如何使用Shell脚本一次运行多个jar文件? [英] How to run multiple jar files at once using shell script?

查看:999
本文介绍了如何使用Shell脚本一次运行多个jar文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与批次相关的类似问题脚本有一个答案.但是我在shell脚本中也需要同样的内容.

Similar question related to Batch script has an answer. But I need same in shell script.

推荐答案

只需启动您的jar并添加&在最后 示例:

Just launch your jar adding a & at the end Example :

#!/bin/bash

java -jar myjar1.jar &
java -jar myjar2.jar &
java -jar myjar3.jar &

如果要让jar在关闭终端后继续运行,请使用nohup:

If you want the jar keep running after closing the terminal, use nohup :

#!/bin/bash

nohup java -jar myjar1.jar &
nohup java -jar myjar2.jar &
nohup java -jar myjar3.jar &

我在项目中使用它,就像一个护身符.

I use it in a project, works like a charm.

这篇关于如何使用Shell脚本一次运行多个jar文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆