Skip to content

Instantly share code, notes, and snippets.

@nassimhaddad
Created November 26, 2013 07:38
Show Gist options
  • Save nassimhaddad/7654680 to your computer and use it in GitHub Desktop.
Save nassimhaddad/7654680 to your computer and use it in GitHub Desktop.
launch and kill R process from R
# getting process id so we can kill it
pid <- system( "Rscript sample.R 500 > test2.txt &
echo $!", intern = TRUE)
system(paste(sprintf("kill %s", pid)))
options(echo=FALSE)
args <- commandArgs(trailingOnly = TRUE)
maxIter <- args[1]
for (i in 1:maxIter){
Sys.sleep(0.1)
cat(i)
cat("\n")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment