Time Command - Part 2


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Time Command - Part 2
# 1  
Old 01-27-2009
Time Command - Part 2

I am trying to collect some scripts performance. I wrote:

#!/usr/local/bin/bash
echo Locked Objects
time /webaplic/monitor_exp_funcional.sh NUM_LOCKED_OBJ
echo Users On
time /webaplic/monitor_exp_funcional.sh USERS_ON



Then I call "test.sh > Results.out"

Obviously, the time command send the stdou to standard erro. So, I should call "test.sh 2> Results.out". But I also want the echo inside the script.

How can I do it?

Thanks in adavance.
# 2  
Old 01-27-2009
I don't have bash, but does calling your script as follows:

Code:
test.sh 2>&1 > Results.out

work?
# 3  
Old 01-27-2009
No... :-(

Still printing the time results on screen and echos msgs with script result on file.
# 4  
Old 01-27-2009
Try combining the channels within the script.

Code:
#!/usr/local/bin/bash
(
echo Locked Objects
time /webaplic/monitor_exp_funcional.sh NUM_LOCKED_OBJ
echo Users On
time /webaplic/monitor_exp_funcional.sh USERS_ON
) 2>&1

# 5  
Old 01-27-2009
It Works!!! :-)

Thanks!
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Extract date and time part from filename

Hi, I am facing one scenario in which I need to extract exact position of date and time from the name of the files. For example, Below is the record in which I need to extract position of YYYYMMDD,HHMISS and YYMMDD. Date and time variables can come more than once. I need to use these position... (13 Replies)
Discussion started by: Prathmesh
13 Replies

2. Shell Programming and Scripting

How to execute a part of code at particular time

I had to execute the following code at 10:00 AM if then echo "Job done"; fi But this is not the entire piece of code, this is sub part of code which alone is to be executed at 10:00 AM, could anyone help me with this? (1 Reply)
Discussion started by: kishore kumar
1 Replies

3. Shell Programming and Scripting

Addition as part of uniq command

Dear Friends, I want to know if it is possible to perform addition as part of uniq command. Input: 213.64.56.208 1 213.64.56.208 2 213.64.56.208 3 213.46.27.204 10 213.46.27.204 20 213.46.27.204 30 The above input should be converted as follows 213.64.56.208 6 213.46.27.204 60 ... (4 Replies)
Discussion started by: tamil.pamaran
4 Replies

4. Shell Programming and Scripting

how to update date part with new increment date time

hi experts, my requirement is like this i need to develop a shell script to update date part with new incremental date time in file some 'X' which is kept at some server location incrementing every two hours.as i am new to this scripting i need support from u people,thanx in advance (1 Reply)
Discussion started by: amanmro
1 Replies

5. UNIX for Dummies Questions & Answers

Differences between time command and usr/bin/time

I wondered if someone could point out the differences between the time commmand and usr/bin/time and the accuracy one might have over another. Also, is there a website or two a person could maybe link for me to describe the differences? Thank you for your time. (2 Replies)
Discussion started by: icedrake
2 Replies

6. UNIX for Dummies Questions & Answers

Need a command to get part of a record from file

I have a file which contains a record like follows /dir1/dir2/dir3/file.dat I need command so that output can be only file.dat (4 Replies)
Discussion started by: sreenusola
4 Replies

7. Shell Programming and Scripting

direction symbol in a variable as part of the command

Hi, How can I get this to work? #!/bin/ksh if ; then direction=">>" else direction=">" fi cat some_file_name $direction temp.txt exit This shell script is not happy with using "$direction" opposed to ">" or ">>". Thanks. (5 Replies)
Discussion started by: peterloo
5 Replies

8. Shell Programming and Scripting

Execute a part of shell script only after particular date and time

I have created a simple shell script... say test.sh Contents of test.sh ================ service named restart cp /etc/imp.conf /backup/test/ #-- if date > 15 July 2007 11:23 pm , then only issue the commans below, else exit --- cp /etc/secondimp.conf /backup/test/ rm -f... (2 Replies)
Discussion started by: fed.linuxgossip
2 Replies
Login or Register to Ask a Question