且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

可以在不知道 jar 文件名的情况下运行 jar 文件

更新时间:2023-09-10 16:03:10

尝试以下方法执行脚本,而无需提及 jar 的发布版本.

Try the below approach for executing script without mentioning the jar's release version.

 #!/bin/bash

PROJECT_HOME=/opt/services/testing-batchp
PROJECT_JAR=batch-*.*.jar
[ -f /etc/environment ] && . /etc/environment

nohup java -jar -Dspring.config.location=${PROJECT_HOME}/config/ ${PROJECT_HOME}/${PROJECT_JAR} $1 $2 >/dev/null 2>&1 &

确保部署文件夹中只有一个有效的 jar.

Make sure that only one valid jar is there in the deployment folder.

推荐文章