Run long code in Ubuntu VM
Run the R code xxxx.R in background.
nohup Rscript xxxx.R > mon_script_$(date +%Y%m%d_%H%M).log 2>&1 & echo $!
It seems safer than running a backgound job in Rstudio-server
You can keep the PID in the name:
LOG="mon_script_$(date +%Y%m%d_%H%M).log"; nohup Rscript xxxx.R > "$LOG" 2>&1 & PID=$!; mv "$LOG" "${LOG%.log}_PID${PID}.log"; echo "PID=$PID"
LOG="mon_script_$(date +%Y%m%d_%H%M).log"; nohup Rscript xxxx.R > "$LOG" 2>&1 & PID=$!; mv "$LOG" "${LOG%.log}_PID${PID}.log"; echo "PID=$PID"
Commentaires
Enregistrer un commentaire