Home > OS >  Submitting R jobs via single ssh command using nohup bash -c
Submitting R jobs via single ssh command using nohup bash -c

Time:01-14

I used to work with an older university server where I could submit analysis jobs using commands like the following. The server was a bit dated and using C Shell.

ssh -t user@oldserver 'cd ~/hte_paper/Code; nohup tcsh -c "R CMD BATCH analysis-file1.r; R CMD BATCH analysis-file2.r" &'

With the Ubuntu 20.04 server images provided by the Uni I work at now, this doesn't work anymore. Neither of the following commands work, nor do any of the variations I've tried. What am I missing? I've been using these commands in Makefiles to automate some work and prefer that over using tmux.

ssh -t user@myserver 'cd ~/some/folder; nohup bash -c "R CMD BATCH analysis-file.r" &' 
ssh -t user@myserver 'nohup bash -c "cd ~/some/folder; R CMD BATCH analysis-file.r" &' 

CodePudding user response:

A friend helped me figure it out. The following works.

ssh -t user@myserver "set -m; cd ~/some/folder; (R CMD BATCH analysis-file1.r; R CMD BATCH analysis-file2.r) &"
  •  Tags:  
  • Related