From owner-freebsd-hackers@FreeBSD.ORG Fri Jan 5 00:32:25 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1554016A5D5 for ; Fri, 5 Jan 2007 00:32:25 +0000 (UTC) (envelope-from stephen@math.missouri.edu) Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) by mx1.freebsd.org (Postfix) with ESMTP id C615713C45D for ; Fri, 5 Jan 2007 00:32:24 +0000 (UTC) (envelope-from stephen@math.missouri.edu) Received: from [10.0.0.4] (12-216-254-44.client.mchsi.com[12.216.254.44]) by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP id <20070105002221m9200kadkoe>; Fri, 5 Jan 2007 00:22:21 +0000 Message-ID: <459D9A3C.5000800@math.missouri.edu> Date: Thu, 04 Jan 2007 18:22:20 -0600 From: Stephen Montgomery-Smith User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.13) Gecko/20061230 X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <20070104210958.GB46929@gort.synoptic.org> In-Reply-To: <20070104210958.GB46929@gort.synoptic.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: Reading in real time from a file without pipes X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Jan 2007 00:32:25 -0000 Matthew Hudson wrote: > Mon Dec 11 09:08:37 PST 2006 c0re dumped wrote: > >>I wonder if is possible to read data from a >>certain file without using a pipe. >> >>Let me explain: >> >>I have a process already writing messages to >>a logfile. I want to read all written data >>(without neither stop nor interfere normal >>log process) from another process in real >>time. >> >>How can I achieve it ? > > > When on the command line, I do this using the program 'socat' > (net/socat in ports). I.e. > socat FILE:/var/log/messages,ignoreeof - > > This gives me the same sort of behavior as 'tail -f' except that > it reads the entire file in first. I also use this when I'm > say scp'ing over a really large tarball of text files and want > to start looking at the files as they're coming in: > * bigdir.tgz is a big tarball being scp'd over, 3 hours remaining * > > socat FILE:bigdir.tgz,ignoreeof - | gzip -dc | tar xf - & > > and just like that I now have bigdir.tgz being expanded in realtime > without having to do anything that may have interfered with the scp (such > as using ssh to run 'tee' on the remote host and do it that way. Wouldn't "tail -f +1" do the same thing?