如何在linux中使用nohup作为后台进程运行进程?
我使用此命令运行我的工作如何在linux中使用nohup作为后台进程运行进程?,linux,Linux,我使用此命令运行我的工作 (time bash executeScript 1 input fileOutput $> scrOutput) &> timeUse.txt 然而,1是我用来运行这项工作的许多进程。我必须更改每次运行的进程数。每次都需要很长时间才能完成。然后我想把它作为后台进程运行 我怎么做 我试过: nohup ((time bash executeScript 1 input fileOutput $> scrOutput) &> ti
(time bash executeScript 1 input fileOutput $> scrOutput) &> timeUse.txt
然而,1是我用来运行这项工作的许多进程。我必须更改每次运行的进程数。每次都需要很长时间才能完成。然后我想把它作为后台进程运行
我怎么做
我试过:
nohup ((time bash executeScript 1 input fileOutput $> scrOutput) &> timeUse.txt)
但它不起作用。- 使用屏幕:启动
,启动脚本,按Ctrl+A,D。使用screen
重新连接screen-r
- 制作一个以“1”为参数的脚本,运行
:nohup yourscript
#!/bin/bash (time bash executeScript $1 input fileOutput $> scrOutput) &> timeUse.txt
nohup CMD&
运行nohup后台进程。但是,当命令的形式是nohup
无法接受时,我将通过bash-c“…
运行它
例如:
nohup bash -c "(time ./script arg1 arg2 > script.out) &> time_n_err.out" &
vi yourscript
脚本中的stdout写入script.out
,而stderr和time
的输出进入time\n\u err.out
因此,在你的情况下:
nohup bash -c "(time bash executeScript 1 input fileOutput > scrOutput) &> timeUse.txt" &
您可以编写一个脚本,然后使用
nohup./yourscript&
执行
例如:
nohup bash -c "(time ./script arg1 arg2 > script.out) &> time_n_err.out" &
vi yourscript
放
您可能还需要更改在服务器上运行脚本的权限
chmod u+rwx yourscript
最后
nohup ./yourscript &
“&”在这里做什么?@acodejdatam,它在后台启动进程而不等待它完成