Using tee | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Using tee

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 10-10-2010
kristinu kristinu is offline
Registered User
 
Join Date: Dec 2009
Last Activity: 29 September 2014, 5:34 PM EDT
Posts: 848
Thanks: 60
Thanked 8 Times in 8 Posts
Using tee

I have been using the command tee to store the output to a file and also write on the terminal. However I would need to put the program in the background although I would still need to see the file being updated like it was doing when using tee.

Any suggestions on how to look at the log file whilst it's being updated?
Sponsored Links
    #2  
Old 10-10-2010
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 1 October 2014, 10:38 PM EDT
Location: NM
Posts: 10,221
Thanks: 278
Thanked 801 Times in 745 Posts
background means you cannot write to your terminal.

Login to a second process (assuming you are not on the console) start your update using tee, and then switch back and forth. Without an extra login, you can also use batch or at to run it without tee and then take a peek at the logfile with tail or tail -f.
Sponsored Links
    #3  
Old 10-10-2010
kristinu kristinu is offline
Registered User
 
Join Date: Dec 2009
Last Activity: 29 September 2014, 5:34 PM EDT
Posts: 848
Thanks: 60
Thanked 8 Times in 8 Posts
The problem with tail -f is that there is a delay between what's being written to the file and what tail outputs.

I have removed using tee and I just redirect to a file. But still want to look at the file being updated. My problem with tee is that if my computer gets in sore sort of problem and have to restart or something, the program will be killed. I am putting the command to run the program on my computer but am running the thing on other machines.
    #4  
Old 10-10-2010
ctsgnb ctsgnb is offline Forum Advisor  
Registered User
 
Join Date: Oct 2010
Last Activity: 1 October 2014, 9:32 AM EDT
Location: France
Posts: 2,930
Thanks: 81
Thanked 624 Times in 596 Posts
Use or install the very usefull tool called "screen" or "GNU screen", you could then launch your script and detach your session so it is just "as if" it was running in background, and you can reattach to your session later
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes



All times are GMT -4. The time now is 02:24 AM.