Total Time


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Total Time
# 8  
Old 05-31-2011
create one file and give execute permission to the file

write the below line the file

Code:
time your-original-script-name

execute the file, you will get the time for execution
# 9  
Old 05-31-2011
Ok, here you go....
Once again
i needed the total time taken by my script called abc.ksh...like 20 mins or 30 mins or anything to be displayed on scrren as soon as abc.ksh is finished.

What i did as per your suggestion, i created a new script something called fff.ksh and inserted a line in it as below:
Code:
time abc.ksh

gave a proper permission..

Next what i did is, inside my original script at the end of abc.ksh, i wrote
/mypath/fff.ksh
below is the output when abc.ksh finished...It didnt gave me any time...
Code:
real    0m0.001s
user    0m0.000s
sys     0m0.000s

# 10  
Old 06-01-2011
I gave you two solutions in the previous posts. What exactly is not working there?

Quote:
Next what i did is, inside my original script at the end of abc.ksh, i wrote
/mypath/fff.ksh
Why?

time(1) gives you elapsed time of command specified as its argument. so it gave you the time it took to execute fff.ksh. But you wanted the time it took to run abc.ksh. So do
Code:
time abc.ksh

instead of
Code:
./abc.ksh

, when you are invoking the script.
# 11  
Old 06-01-2011
OK here you go....
My name of the script is abc.ksh which is approximately taking 8 to 9 mins to execute but iam not sure how exact it is ...so i needed help so posted here...
my abc.ksh script is as below...
Code:
#! /bin/ksh
pun=/usr/mi/tics/Par
/$pun/ihy_ed.ksh
ret=$?
if [ $ret -ne 0 ]
then
        echo
        echo " =====> ERROR OCCURRED WHILE RUNNING ihy_ed.ksh <===== "
        echo " =====> ERROR CODE RETURNED BY ihy_ed.ksh=$ret <===== "
exit $ret
else
        echo " ====> THE SCRIPT COMPLETED WITHOUT ANY ERRORS ====> "
        echo
fi

The above code for the script name abc.ksh works absolutely fine and its taking 8 to 9 mins but dont know the exact time...
I execute it the the below way...
Code:
./abc.ksh

now @mirni-- as you said just put the time before the abc.ksh and i did that after the abc.ksh is completely executed.
And below is the out put on the screen after i wrote
-----time abc.ksh

Code:
-bash: abc.ksh: command not found
real    0m0.001s
user    0m0.000s
sys     0m0.000s

its not displaying above like 8 or 9 mins as such..

---------- Post updated at 12:27 PM ---------- Previous update was at 12:24 PM ----------

What exactly should i do in my script (abc.ksh) so that it will show me in the end saying that the script took 8 or 9 or any mins or hours to execute..
# 12  
Old 06-01-2011
you are executing wrong , i mean without the relative path.

Code:
time ./abc.ksh

This will work
# 13  
Old 06-01-2011
ok thanks @Kumaran..i will surely try it....
one more thing where should i incorporate the above line ..
do u mean i should put it in the end of my script (abc.ksh)...so that as soon as abc.ksh is finished it will give me the total time it completed...
# 14  
Old 06-01-2011
No. You have to execute your script using that line.

usually you execute your command with

Code:
prompt> ./abc.ksh

But now
Code:
prompt> time ./abc.ksh

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Total size utilizes by the files older than a time span

Through find command I identified the files older that 1 year. I need the overall size utilizes by these 1 year older files. Please share me the command to identify it .Thanks Please post in an adequate technical forum! (3 Replies)
Discussion started by: Sang
3 Replies

2. Solaris

Total

i want to list Total HDD count in any soalris machine..can someone suggest some commands or combinations of commands (6 Replies)
Discussion started by: omkar.jadhav
6 Replies

3. UNIX for Dummies Questions & Answers

Dig total query time?

I'm using a .txt file filled with domain names for dig to use, the problem is that when i look at the results I get the query time for each individual query, I want to know how long it took in total for all queries to run, how can I achieve this? any help would be greatly appreciated, thank you.... (3 Replies)
Discussion started by: r7a7v7
3 Replies

4. Shell Programming and Scripting

Total time taken

Hi Friend, Need your help. I have a file which has information of start time and End time . I need to find how much time takes to complete the job . how can I do it in unix command . Example of Log file : Start Loading ---Thu Aug 2 17:14:09 EDT 2012 Load... (5 Replies)
Discussion started by: deep_kol
5 Replies

5. Shell Programming and Scripting

Help with sum total number of record and total number of record problem asking

Input file SFSQW 5192.56 HNRNPK 611.486 QEQW 1202.15 ASDR 568.627 QWET 6382.11 SFSQW 4386.3 HNRNPK 100 SFSQW 500 Desired output file SFSQW 10078.86 3 QWET 6382.11 1 QEQW 1202.15 1 HNRNPK 711.49 2 ASDR 568.63 1 The way I tried: (2 Replies)
Discussion started by: patrick87
2 Replies

6. Shell Programming and Scripting

How to get total time using awk

Hi guys, I can't find a solution to sum the h:m:s: columns. 28/05/2010 03h 29min 34seg ADSL TELEMAR 28/05/2010 12h 19min 21seg ADSL TELEMAR 29/05/2010 04h 20min 02seg ADSL TELEMAR 29/05/2010 04h 31min 45seg ADSL TELEMAR 30/05/2010 06h 10min 43seg ADSL TELEMAR Thanks Use code... (8 Replies)
Discussion started by: ashimada
8 Replies

7. Shell Programming and Scripting

Calculate total space, total used space and total free space in filesystem names matching keyword

Good afternoon! Im new at scripting and Im trying to write a script to calculate total space, total used space and total free space in filesystem names matching a keyword (in this one we will use keyword virginia). Please dont be mean or harsh, like I said Im new and trying my best. Scripting... (4 Replies)
Discussion started by: bigben1220
4 Replies

8. UNIX for Dummies Questions & Answers

du total

Hi All Can anyone help me with the following du querry. I am trying to achieve a total size for all the zipped files in a directory. Using du -k *.gz gets me a file by file list but no handy total at the bottom. Thanks Ed (9 Replies)
Discussion started by: C3000
9 Replies

9. UNIX for Dummies Questions & Answers

grep running total/ final total across multiple files

Ok, another fun hiccup in my UNIX learning curve. I am trying to count the number of occurrences of an IP address across multiple files named example.hits. I can extract the number of occurrences from the files individually but when you use grep -c with multiple files you get the output similar to... (5 Replies)
Discussion started by: MrAd
5 Replies
Login or Register to Ask a Question