Alex Brown
Alex Brown

Reputation: 89

Get the time when nohup R program finishes

I want to get the time when program finish. But it always show the same time. Here is my shell script. It always show that START TIME is same as END TIME. How do I fix that?

START=$(date +"%r") 
nohup Rscript program_1.R >program_1.Rout & wait & echo START TIME = $START\n END TIME = " `date +"%r"`";

Upvotes: 1

Views: 224

Answers (1)

pacholik
pacholik

Reputation: 8972

You are sending only the R script to the background, date is executed immediately.

Instead of

date +%r; sleep 5 & date +%r

do

date +%r; (sleep 5; date +%r) &

Upvotes: 1

Related Questions