Nohup in conjunction with time


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Nohup in conjunction with time
# 1  
Old 05-01-2013
Nohup in conjunction with time

hi,
if I exectute "nohup time ls -1" I get the following output

Code:
[user@hostname directory]$ nohup time ls -1
file_1
file_2
file_3
file_4
file_5
0.000u 0.001s 0:00.00 0.0%      0+0k 0+0io 0pf+0w

This is all OK.

But if I want to capture this whole output in to a text file I would want to use something like

Code:
[user@hostname directory]$ nohup time ls -1 >output.txt
0.000u 0.002s 0:00.00 0.0%      0+0k 0+8io 0pf+0w
[user@hostname directory]$ more output.txt
file_1
file_2
file_3
file_4
file_5
output.txt


My problem is that the output.txt doesn't contain the result from the "time" command. It looks like to me that nohup didn't recognise that at the end of the command line, the output redirection was meant for the entire nohup command. ls -1 command seems to just take the output redirection for itself.

How can I get the entire result of nohup to be put in the output.txt file?

I tried a lot of weird ways but just couldn't get it worked.

I'd prefer bash solutions.

Last edited by radoulov; 05-01-2013 at 10:38 AM..
# 2  
Old 05-01-2013
The output of from the time keyword or shell built-in should be directed to the standard error output. Try:
Code:
nohup time ls -1 >output.txt 2>&1

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Nohup apending data each time i run script

I have a problem here. i am running my script in nohup but if i run it 2 or three time , in my output i see it is giving me old data as well, in-spite i delete nohup.out file. i tried to look a lot from where the old data is coming. can some one tell me how the old data is also coming again and... (11 Replies)
Discussion started by: mirwasim
11 Replies

2. Shell Programming and Scripting

Saving nohup output to a file other than nohup.out

Shell : bash OS : Oracle Linux 6.4 I want to save the ouput of a nohup command to file other than nohup.out . Below are my 3 attempts. For both Attempt1 and Attempt2 , the redirection logs the output correctly to the output file. But I get the error "ignoring input and redirecting stderr to... (7 Replies)
Discussion started by: kraljic
7 Replies

3. Shell Programming and Scripting

Problem with date in conjunction with cut?

I got rather bored so i decided to create a script that creates a countdown, and shows hours:minutes:seconds till that time. It works fine until the seconds of the actual time reaches 8, then it tries to use it to work out the difference as in "SECONDDIFF=$" Here's my code where I get the... (12 Replies)
Discussion started by: DuskFall
12 Replies

4. Shell Programming and Scripting

How to go about Using a "Validate an IP script" in conjunction with Logfile?

Hi, so I have been trying to write a shell script to go through a log file and through that, generate another file with all the Valid IP addresses it finds. So there's the complication that there could be incomplete or invalid data which would disqualify it from making my "Valid IPs" file I need... (3 Replies)
Discussion started by: shellcow
3 Replies

5. UNIX for Dummies Questions & Answers

Help needed for nohup time

Hi All, Firstly thanks for reading my query..I am a complete newbie in Unix and I recently read about nohup command which is responsible to continue execution in background. But I have found some command where time is used alongwith nohup as given below:- nohup time A.sh & I don't know why... (2 Replies)
Discussion started by: saswati16
2 Replies

6. Shell Programming and Scripting

nohup output on screen for some time

Hi, I'm executing a binary with nohup in a menu(shellscript) and output is going to nohup.out fine. I need few lines of nohup.out should be displayed on screen so that I will come to know the process is successfully started and continue with other options in my menu. Thanks in advance. (3 Replies)
Discussion started by: axes
3 Replies

7. Shell Programming and Scripting

Missing conjunction

Hi Gurus, I have prepared a script to find the log file based on a date range defined in one of the environment files, archive the logs files and move them to a particular directory. Below is the script: . /home/.profile . /home/.inf_env logfile=$scripts_path/Logs/file_archive1.log... (17 Replies)
Discussion started by: svajhala
17 Replies

8. UNIX for Dummies Questions & Answers

Run process with nohup every certain time

Hi, I need execute a script every 30 minutes. As might be done without using cron Thx. (6 Replies)
Discussion started by: pepeli30
6 Replies

9. Shell Programming and Scripting

conjunction two files

I need to your help. I want write a script search for rows in file1 if exist in file2 it will print rows from file2 else it will print rows from file1 with out any duplicate ... (4 Replies)
Discussion started by: kmuqalled
4 Replies

10. UNIX for Dummies Questions & Answers

nohup - help!

I find that if I use nohup (in bourne shell script) then all the interactive parts in my code are gone hidden... e.g., the places asking input from the user (such as ckyorn) will not be displayed. This is no good. Is there a way to use nohup (or similar utility) and meanwhile, to keep the... (9 Replies)
Discussion started by: bluemoon1
9 Replies
Login or Register to Ask a Question