Date: Thu, 04 Jan 2007 18:22:20 -0600 From: Stephen Montgomery-Smith <stephen@math.missouri.edu> To: freebsd-hackers@freebsd.org Subject: Re: Reading in real time from a file without pipes Message-ID: <459D9A3C.5000800@math.missouri.edu> In-Reply-To: <20070104210958.GB46929@gort.synoptic.org> References: <20070104210958.GB46929@gort.synoptic.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?459D9A3C.5000800>