Entering edit mode
4.0 years ago
szp770
▴
10
Hi, all. Now I have an R script and bam files in my linux system. I want to know how to run this R script with nohup. Thanks!
Please don't. Use
screen
ortmux
.Use
Rscript
not theR
binary. As Wouter said,tmux
andscreen
are better choices, but have a bit more of a learning curve.Otherwise, using
nohup
withRscript
is the same as for any other binary:(or whatever the execution for your script looks like).
How does
screen
have a learning curve? You open a new screen byscreen -S <screenname>
, leave it by pressingCtrlA
thenCtrlD
, and return to the screen by typingscreen -r <screenname>
. Agreed that this is far better thannohup
. @OP, can you elaborate on which system you are, so a cluster, AWS, personal laptop etc? Is running RStudio an option for a GUI?The learning curve is that you need to get used to the idea that its a 'separate' terminal session, this has implications for preserving the
history
, the scrollback buffer, process ownership, the fact thatCtrl-A
no longer moves the cursor to the start of the line, and for attaching and detatching sessions (as well as how to figure out what session is what etc. The list goes on...There's no doubt in my mind it has extra hurdles than
nohup
, but I'm not disputing that its worthwhile! :)I see your point, probably I simply got too used of using
screen
for years that I forgot about the little details.