Dear Julia users,
I am on a ubuntu machine. I want to run my Julia codes “main.jl” in background. What commend to realize this? Something like “nohup Julia command main.jl &”?
Thanks a lot!
Dear Julia users,
I am on a ubuntu machine. I want to run my Julia codes “main.jl” in background. What commend to realize this? Something like “nohup Julia command main.jl &”?
Thanks a lot!
That is how I do it.
I got this error as below
nohup: ignoring input and appending output to ‘nohup.out’
nohup: failed to run command ‘Julia’: No such file or directory
[1]+ Exit 127 nohup Julia CMD main_script.jl
julia is lowercase, at least on my system.
I tried both upper case Julia and lower case julia. Same error message.
“Julia main_script.jl &” is fine. But the error message shows up after adding “nohup”
pkrysl@Hogwarts:~$ cat wher.jl
println("Here: $(pwd())")
exit()
pkrysl@Hogwarts:~$ nohup julia-3e47047021/bin/julia wher.jl &
[1] 14324
pkrysl@Hogwarts:~$ nohup: ignoring input and appending output to 'nohup.out'
cat nohup.out
Here: /home/pkrysl
[1]+ Done nohup julia-3e47047021/bin/julia wher.jl
pkrysl@Hogwarts:~$
The only difference I see is “julia-3e47047021/bin/julia” versus “julia”. So what is this piece of information “-3e47047021?” Thanks a lot.
I meant I don’t know how to specify this part “julia-3e47047021/bin/julia” for my ubuntu machine.
Please do which julia
. That will tell you where it is.
About the name of the folder: I just never bothered to rename the nightly Julia folder. It is called julia-3e47047021
.
Ok. Thank you, Petr! With Julia’s full path, it works. I have also created an alias for the Julia path. So “nohup julia .jl &” also works now.
I would install ‘screen’ then start a screen session in a terminal.
screen -S background-julia
julia wher.jl
Ctrl-a then D will detach the terminal and leave the process running in the bacground
screen -r in a different terminal or the same terminal will reconnect you
When working on a remote server screen is invaluable
I would also recommend tmux in place of nohup/screen.
What is the advantage of screen comparing to nohup?
I heard tmux is comparable to screen. Any particular reason on recommending tmux in place of nohup/screen?
Just tried screen - nice tool! Thanks a lot.
I have two question which are not included in the tutorial you recommended - appreciate your help in advance.
screen -r
There are several suitable screens on:
10353.background-julia (05/07/2020 06:29:12 PM) (Attached)
10243.background-julia (05/07/2020 06:21:49 PM) (Detached)
10143.background-julia (05/07/2020 05:52:12 PM) (Attached)
10073.session_name (05/07/2020 05:36:10 PM) (Attached)
10061.session_name (05/07/2020 05:36:05 PM) (Attached)
10046.pts-1.ip-10-0-8-77 (05/07/2020 05:34:05 PM) (Detached)
If it’s just a single process you want to run dtach also works great