How to run R script in linux system
0
0
Entering edit mode
17 months 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!

R ChIP-Seq genome next-gen sequence • 611 views
ADD COMMENT
2
Entering edit mode

with nohup

Please don't. Use screen or tmux.

ADD REPLY
1
Entering edit mode

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).

ADD REPLY
1
Entering edit mode

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?

ADD REPLY
1
Entering edit mode

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! :)

ADD REPLY
0
Entering edit mode

I see your point, probably I simply got too used of using screen for years that I forgot about the little details.

ADD REPLY

Login before adding your answer.

Traffic: 1280 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6