I want to run the following Linux command a number of times in a loop and want to plot the variations in real time using gnuplot.
time scp -i k30.pem [email protected]:/home/ubuntu/pics/* /home/pi/
But I am facing problem of how to extract the output of above command into a spreadsheet column so that i could plot it using gnuplot
later.
I am using latest version of Raspbian in my Raspberry Pi model 3B+.
Please help.
GNU time
has -o FILE
parameter that you can use to output the timing into a file. You can process the file, extract the timing from the file and put it somewhere in CSV or such in a loop.
It also has -f format
option that lets you customize the output format of the time
.
So, in your case it could go like this:
/usr/bin/time -o mytime.log -f "%e" scp -i k30.pem [email protected]:/home/ubuntu/pics/* /home/pi/
In this command the "%e"
format makes the GNU time
print only elapsed real time in seconds.