This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to run R script in linux system

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!

r chip-seq genome next-gen sequence

with nohup

Please don't. Use screen or tmux.

Use Rscript not the R binary. As Wouter said, tmux and screen are better choices, but have a bit more of a learning curve.

Otherwise, using nohup with Rscript is the same as for any other binary:

$ nohup Rscript /path/to/script.r <options> files

(or whatever the execution for your script looks like).

How does screen have a learning curve? You open a new screen by screen -S <screenname>, leave it by pressing CtrlA then CtrlD, and return to the screen by typing screen -r <screenname>. Agreed that this is far better than nohup. @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 that Ctrl-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.

0 answers

No answers yet.

Log in to answer this question.