简体   繁体   English

关闭命令提示符或腻子后如何保持 julia 运行

[英]How to keep julia running after I close the command prompt or putty

I am running a big julia simulation in AWS machine (linux).我正在 AWS 机器(linux)上运行一个大型的 julia 模拟。 I use putty to run from the command line.我使用腻子从命令行运行。

I type: julia myscript.jl我输入: julia myscript.jl

However, whenever I close the command prompt, or putty or my laptop, the run on the AWS server will stop.但是,每当我关闭命令提示符、腻子或笔记本电脑时,AWS 服务器上的运行都会停止。 I wonder if anyone knows is there a way to keep julia running when I close the command line prompt.我想知道是否有人知道当我关闭命令行提示符时有没有办法让 julia 继续运行。 As I do not want to keep my laptop open and putty stay connected for several days因为我不想让我的笔记本电脑保持打开状态并且腻子保持连接几天

Thanks谢谢

dtach exists for this purpose. dtach就是为此目的而存在的。 It will keep a process alive even if the terminal session that created the process is closed.即使创建进程的终端会话关闭,它也会使进程保持活动状态。

Once you log in through ssh, start a new dtach session:通过 ssh 登录后,开始一个新的 dtach 会话:

$ dtach -A /tmp/my-dtach-session julia myscript.jl

Then detach from the session with ctrl+\\ .然后使用ctrl+\\从会话中分离。

Detaching will not kill your process.分离不会终止您的进程。 Here I check that it is still running after detaching:在这里,我检查分离后它是否仍在运行:

[david@blue ~] $ ps aux | grep dtach                                       
david      506  0.0  0.0   8460  1484 ?        Ss   16:15   0:00 dtach -A /tmp/my-dtach-session ./pkg/julia-1.3.0/bin/julia
david      517  0.0  0.0   6140  2224 pts/2    S+   16:16   0:00 grep dtach

After you detach, you can close your ssh session like normal.分离后,您可以像往常一样关闭 ssh 会话。 If your process has not finished, you can log back in and reattach:如果您的过程尚未完成,您可以重新登录并重新附加:

$ dtach -a /tmp/my-dtach-session 

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM