[CentOS] Timing a command

Sat Jan 26 00:15:18 UTC 2008
redhat at mckerrs.net <redhat at mckerrs.net>

----- "Scott Ehrlich" <scott at MIT.EDU> wrote:
> I want to keep track of how long a task is running.  Thinking it
> wouldn't 
> take that long, I opted not to run time before it.  The fact that it
> is 
> taking a long time, if I revisit the machine in the morning, what
> would be 
> the best way to find out what time it ended?
> 
> In this case, I'm using mt to erase an lto3 tape - sudo mt -f /dev/st0
> 
> erase.  But I'd like to use the knowledge from this question to track
> 
> other events, too.
> 
> I feel like I should know this answer, but cannot think of the
> solution at 
> the moment.
> 
> Thanks.
> 
> Scott
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.

Dunno, maybe you could check for the existance of /proc/$PID every 10 seconds or so from a shell script. And then note when $PID disappeared ?

or

run strace on the process and write the output to a tmp file. The last update of the logfile should coincide with the process ending.


Those are my best shots early on a saturday morning !

Cheers.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.