PDA

View Full Version : can we find out how much time the script takes to execute


o0O0o.o0O0o
07-21-2008, 06:23 AM
hi ,

Is there any command to find out that how much time the scipt takes execute in Linux shell.

I am making datbase backup using shell and i also want to append to file name that how many seconds the script takes to execute.

Any one have got any remotest clue ?

oracleguy
07-21-2008, 02:57 PM
time <command to run>

o0O0o.o0O0o
07-22-2008, 12:30 AM
How can i use that inside the command i want to use like

mysqldump . . . . > database_time.sql

oracleguy
07-22-2008, 02:15 AM
Well you can dump the data into a file or shell variable and then parse the information.

like:

time (mysqldump ... > database_time.sql) 2> runtime
... parse runtime for information ...

rm runtime

... rename database_time.sql to include the runtime ...


Also look at the man page for time, it has quite a few options for controlling the format of its output.