我scp在后台运行命令:
nohup scp file.gz root@target-host:/root/ > nohup.out 2>&1
Run Code Online (Sandbox Code Playgroud)
我输入了密码-我ctrl-z按下来中止该命令并使用重新启动它bg,可以通过执行确认它正在运行jobs。但是,有没有一种方法可以监视文件传输的进度(即是否可以在不将其放在后台运行的情况下运行它)?
谢谢。
我正在使用远程系统,我使用Pycharm远程窗口来编辑和运行我的脚本.
我登录使用
ssh -Y myName@myMachine
Run Code Online (Sandbox Code Playgroud)
然后我从终端运行Pycharm.
我想以这样的方式从Pycharm运行我的脚本,如果我关闭它(甚至可能从ssh会话注销),进程仍然会运行.
我试图使用选项"分离而不终止进程"退出Pycharm.这导致python进程显示在以下列表中:
ps -all
Run Code Online (Sandbox Code Playgroud)
但是,它会停止写入文件.当pycharm打开时,进程通常每隔几秒就写入一个文件.当从pycharm脱离它显示的过程(注销和重新登录它显示与未知TTY PS -x之后)就行了,但它停止在这个意义上工作,它不再追加任何输出文件,它通常应.
可能导致什么呢?我怎样才能解决这个问题?
我正在使用 nohup 命令运行 Java 应用程序。
nohup java -jar test.jar
Run Code Online (Sandbox Code Playgroud)
我正在使用log4j从我的应用程序中写入输出。在 log4j.properties 文件中,我有一个写入输出的文件。问题是我在 nohup.out 和 test.log 中有两次相同的输出(我在 log4j.properties 文件中配置了这个)
有没有办法禁止将输出写入 nohup.out?
我正在使用subprocess.Popen启动多个进程.
代码是这样的:
while flag > 0:
flag = check_flag()
c = MyClass(num_process=10)
c.launch()
Run Code Online (Sandbox Code Playgroud)
MyClass 如果类似以下内容:
MyClass(object)
def __init__(self, num_process):
self.num_process = num_process
def launch(self):
if self.check_something() < 10:
for i in range(self.num_process):
self.launch_subprocess()
def launch_subprocess(self):
subprocess.Popen(["nohup",
"python",
"/home/mypythonfile.py"],
stdout=open('/dev/null', 'w'),
stderr=open('logfile.log', 'w'),
shell=False)
Run Code Online (Sandbox Code Playgroud)
在大多数情况下,启动的子流程有时会在运行过程中死亡.在某些情况下,它完成.
但是,如果我subprocess.Popen在while循环中直接使用,则该过程会继续并及时完成.
有人能告诉我如何通过上面描述的方式使用子进程来让进程在后台运行?
我有一个运行gradle build这样的脚本......
$HOME_DIR$CODE_DIR/gradlew -p $HOME_DIR$CODE_DIR build
Run Code Online (Sandbox Code Playgroud)
当我定期运行./start.local.sh它时,它工作正常。但是当我尝试像nohup ./start.local.sh &我一样使用 nohup 时......
Exception in thread "DisconnectableInputStream source reader" org.gradle.api.UncheckedIOException: java.io.IOException: Bad file descriptor
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:57)
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40)
at org.gradle.util.DisconnectableInputStream$1.run(DisconnectableInputStream.java:125)
at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: java.io.IOException: Bad file descriptor
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
我使用以下命令在后台执行了一个perl脚本
nohup perl myPerlSCript.pl >debug_log &
Run Code Online (Sandbox Code Playgroud)
几分钟后,我得到了状态
[1] +停止
我没想到它会停止,也不知道是什么阻止了它.我该如何调试它并找出它停止的原因?我真的很想知道要调试的unix命令.
我在使用nohup在后台运行top命令时遇到问题.首先,我在本地运行,如
nohup top &
Run Code Online (Sandbox Code Playgroud)
它抱怨nohup.out文字top: failed to get tty.我的最终目标是在远程机器上运行,如
nohup ssh -t user@hostname top &
Run Code Online (Sandbox Code Playgroud)
目前,上述命令也失败了
Pseudo-terminal will not be allocated because stdin is not a terminal.^M
TERM environment variable not set
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
PS:我运行此命令ping machineB从machineA.machineA总是活着,但并非总是登录.
从nohup文档中info coreutils 'nohup invocation'可以看出:
Exit status:
125 if `nohup' itself fails, and `POSIXLY_CORRECT' is not set
126 if COMMAND is found but cannot be invoked
127 if COMMAND cannot be found
the exit status of COMMAND otherwise
Run Code Online (Sandbox Code Playgroud)
但是,我从nohup获得的唯一退出代码是1和0.我有一个nohup命令在脚本中失败,我需要适当的例外...并且根据这个文档,我会假设nohup退出代码应该是126.相反,它是0.
我正在运行的命令是: nohup perl myscript.pl &
这是因为perl成功退出了吗?
我是python和web开发的新手,我有一个基本问题我相信.
我正在使用金字塔运行我的服务器,并使用nohup.out将输出写入文件.
nohup ../bin/pserve development.ini
Run Code Online (Sandbox Code Playgroud)
当我这样做时,tail -f nohup.out
我可以看到来自logging.info()我的代码中的调用的所有输出.
但我没有看到print()来电的所有输出.
是什么原因,我如何设置它将在nohup文件中看到print()?
更新:根据下面的讨论,我对答案进行了编辑,以获得更准确的描述。
我正在尝试从jenkins运行nohup命令。完整的命令是
nohup java -jar /home/.../jar/server-process-0.35.jar prod >> /var/../server-process-prod.log 2>&1 &
Run Code Online (Sandbox Code Playgroud)
该命令不起作用。我可以在jenkins中将状态视为成功,但在Linux中则看不到Java进程。当我做ps -ef | grep java'
但是,当我删除最后一个'&'时,我将其更改为从forground而不是背景运行
它开始工作。我可以看到Java进程已启动。
如果我在linux控制台上运行原始命令,则该命令运行良好。
我需要从jenkins以原始形式运行它,作为backgorund进程。这样它就独立于詹金斯。
任何线索为什么会这样?