Difference between revisions of "R Job Script"

From UFRC
Jump to navigation Jump to search
Line 1: Line 1:
 
<source lang=bash>
 
<source lang=bash>
 
#!/bin/bash
 
#!/bin/bash
#
 
 
#PBS -N R-demo
 
#PBS -N R-demo
 
#PBS -M YOUREMAIL@ufl.edu
 
#PBS -M YOUREMAIL@ufl.edu
Line 10: Line 9:
 
#PBS -l pmem=1gb
 
#PBS -l pmem=1gb
 
#PBS -l walltime=00:05:00
 
#PBS -l walltime=00:05:00
#
+
#Change to the current working directory if inside a job
 
+
if [[ -d $PBS_O_WORKDIR ]]; then cd $PBS_O_WORKDIR; fi
#Change to the directory from which the job was launched.
 
cd $PBS_O_WORKDIR
 
  
 +
#Record the time and compute node the job ran on
 +
date; hostname
 
#Use modules to load the environment for R
 
#Use modules to load the environment for R
 
module load R
 
module load R
  
 
#Run R script  
 
#Run R script  
R CMD BATCH myRscript.R
+
Rscript myRscript.R
 
</source>
 
</source>

Revision as of 16:25, 11 April 2015

#!/bin/bash
#PBS -N R-demo
#PBS -M YOUREMAIL@ufl.edu
#PBS -m abe
#PBS -o R_demo.$PBS_JOBID.out
#PBS -j oe
#PBS -l nodes=1:ppn=1
#PBS -l pmem=1gb
#PBS -l walltime=00:05:00
#Change to the current working directory if inside a job
if [[ -d $PBS_O_WORKDIR ]]; then cd $PBS_O_WORKDIR; fi

#Record the time and compute node the job ran on
date; hostname
#Use modules to load the environment for R
module load R

#Run R script 
Rscript myRscript.R