简体   繁体   English

如何像在后台该目录中一样执行脚本(例如mvnw)?

[英]How to execute a script (e.g. mvnw) as if you were in that directory in the background?

I have my application with maven where you can 'cd' to this directory /path/app/execute/. 我的应用程序带有maven,您可以在其中“ cd”到该目录/ path / app / execute /。 and run 'mvnw' and the app starts fine. 并运行“ mvnw”,应用启动正常。

My problem is I want to create a start script in the parent directory here: /path/app/startMyApp.sh. 我的问题是我想在此处的父目录中创建一个启动脚本:/path/app/startMyApp.sh。

It's contents are: 它的内容是:

nohup /path/app/execute/mvnw &

My problem is, when I cd to /path/app and run './startMyApp.sh', I am getting: 我的问题是,当我CD到/ path / app并运行'./startMyApp.sh'时,我得到了:

Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain 错误:找不到或加载主类org.apache.maven.wrapper.MavenWrapperMain

How can I keep my script in the parent directory of the "mvnw" executable, and be able to execute it as if I were in that directory as a background process (nohup) in the script? 如何将脚本保存在“ mvnw”可执行文件的父目录中,并能够像在脚本中作为后台进程(nohup)一样在该目录中执行它?

注意问题中“ mvnw”和“ mvn”之间的区别,如果问题的症结在于将目录更改为nohup下的/ path / app / execute,则:

nohup sh -c 'cd /path/app/execute; mvnw' &

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何安全地为要启动的后台应用程序提供敏感信息(例如密码)? - How do you securely provide a sensitive info (e.g. password) to a background application to be started? 我如何读取在KieSession外部插入的事实(例如规则结果)? - How can I read facts outside of the KieSession that were inserted inside of the KieSession­ (e.g. rules results)? 如何为Android应用创建标题屏幕? 例如,当应用程序像Facebook一样加载时 - How do you create a title screen for an android app? E.g. When the app is loading like Facebook 如何从 MacOS 卸载 Java 版本(例如,openjdk 15)? - How do you uninstall a version of Java (e.g., openjdk 15) from MacOS? 您如何处理从文件上传的数据? 例如,计算总和? java的 - how do you work with data uploaded from files? e.g., calculate the sum? java JMH启动脚本->例如,设置Iterations(5) - JMH start script -> e.g. set Iterations(5) 使用Java for Android平台评估脚本(例如Python) - Evaluate a script (e.g. Python) in Java for Android platform 在Eclipse中,如何使用“ Workspace…”语法(例如$ {workspace_loc:/ myworkspace})指定文件(用于控制台日志)? - In Eclipse, how do you specify a file using the “Workspace…” syntax (e.g. ${workspace_loc:/myworkspace} ) (for a console log)? 如何按等级对数组的值进行排序(例如85-100是A,70-84是B等) - How do you sort the values of arrays by grade (e.g. 85-100 is an A 70-84 is a B etc.) 你如何让java在两个范围内创建一个随机数(例如5-10和12-17) - How do you have java create a random number within two ranges (e.g. 5-10 and 12-17)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM