I know my script is going to take more than 10 hours to run. Is there a way to log the time it starts and the time it ends ?
Does the time
command just time the process or do I get the output of the process that I'm timing ?
I know my script is going to take more than 10 hours to run. Is there a way to log the time it starts and the time it ends ?
Does the time
command just time the process or do I get the output of the process that I'm timing ?
I am not sure I get your question.
time <command>
will give the time taken by<command>
. If you want the actual start and end times to be printed as well, you can do:Use the
time
command (details):If
time
does not fit for you, I would try to log the output ofdate
(details) before and after the execution of your program, e.g.Finally, you can also add some formatting (NOTE: inspired by Raze2dust's answer):
The
time
command shows how long your process runs:sleep 2
is just a simple process that takes 2 seconds.To log the current time, use the
date
command.At the beginning and ending your script you just need to have date commands which will log the information.