/bin/sh calls tee which never exits

Bill Campbell linux-sxs
Thu Mar 22 08:29:17 PDT 2007

On Thu, Mar 22, 2007, James McDonald wrote:
>Bill Campbell wrote:
>>On Thu, Mar 22, 2007, James McDonald wrote:
>>>I have an issue with a backup script on a Redhat EL3.1 box
>>>Until recently it worked fine but now that a new command has been added 
>>>in the form of:
>>>program_to_execute "program args" 2>redirect_to_file &
>>>I am having to kill the tee -a $LOG process called as shown in the tree 
>>>below to let it complete
>>It appears that $program_to_execute is a script that contains the
>>tee command.
>In the ascii picture I sent everything with a dot in it's name is a bash 
>script. The tee command is called from backup.sh which is calling 
>start_all.sh | tee -a $LOG and start_all.sh then calls all the scripts 
>underneath it. Finally calling a Progress binary which has it's stderr 
>diverted to a file and is backgrounded. Eventually all those scripts 
>should return Since this new process has started being called it appears 
>tee is just hanging.... waiting for any stdout which might come from the 
>backgrounded progress process.

That's not hanging, but doing what it's supposed to do.  If
anything is hanging, it's probably something in the call chain
that the start.sh script invokes.

If one wants to keep a log of multiple processes like this, it's
probably best to wrap them in their own shell:

) 2>&1 | tee somelog

INTERNET:   bill at Celestial.COM  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

``The whole aim of practical politics is to keep the populace alarmed (and
hence clamorous to be led to safety) by an endless series of hobgoblins.''
   -- H.L. Mencken, 1923

More information about the Linux-users mailing list