1832124 Members
3188 Online
110038 Solutions
New Discussion

timing a process

 
SOLVED
Go to solution

timing a process

i have a process that cron runs, and i need to find out the time that it takes to run each morning. if i replace the cron job
/the/script
with:
time /the/script >> /stats/file
it doesnt work, probably because the standard output of this command is the output of the script, not the time command. anyone know how i can manage this? im not able to run the script on my own and time the result, as it has to run at a specific time. thanks
just do it!
3 REPLIES 3
James R. Ferguson
Acclaimed Contributor
Solution

Re: timing a process

Clint:

# time script_name > /tmp/log 2>&1

would place your output and the time results (stderr) into /tmp/log.

# time script_name > /tmp/log 2> /tmp/errlog

would keep the script output and the time statistics in separate files.

...JRF...
Dave Wherry
Esteemed Contributor

Re: timing a process

You can also preface your command with the timex command. It reports "in seconds the elapsed time, user time and system time spent in execution of the given command".
Use it just as the examples James gave for the time coomand. I've used timex often and it works very well.

Re: timing a process

thanks James and Dave, for the speedy responses.
just do it!