java - Run jar on remote machine as background process over ssh
问题描述
I want to run a jar as a background process on a remote machine over ssh connection. There is bash script on remote machine to execute jar
#!/bin/sh
export JAVA_HOME=/location/of/java/
export PATH=$JAVA_HOME/bin:$PATH
nohup java -jar jar_name.jar config.properties &
If I execute the above script directly from remote machine(sudo ./start_script.sh
), jar is started as background process and stdout is directed to nohup.out
in the same folder as jar. But when I run script from local machine : ssh vm_name 'sudo ./start_script.sh'
, the process starts up. but it blocks and the output is directed to local terminal.
is there way to achieve this?
EDIT: I need to run script as root and also pass parameters to script, added placeholder path for JAVA_HOME to avoid confusion
解决方案
与此处相关的相同问题:
尝试
$ ssh user@host bash -l ./build.sh
推荐阅读
- angular - Angular HttpClient 缺少响应标头
- python - 如何使用 Python 搜索和下载文件(不提及文件的 URL)?
- c# - 运行 Scaffold-DbContext 时出现超时错误
- python - 基准测试python(命令行)
- php - 如何拆分数组值,按第一个子字符串分组,并组合第二个子字符串值?
- firebase - firebase数据库读写权限被拒绝
- javascript - 如何在javascript中将八位字节流保存为zip?
- php - 从 php 表单发布到 CSV 文件时没有调用 DateTime
- python - scrapy - 如何使用正则表达式检索变量值
- apache-spark - 从驱动程序运行多个 spark-submit 实例