psfales@cbnewsc.ATT.COM (Peter Fales) (11/10/89)
In article <256@telxon.UUCP>, dank@telxon.UUCP (Dan Kelley) writes: > > I am looking for an idea to duplicate output on different terminals. > Obviously, the choice at first is easy, just use the "tee" program > in this manner: > program | tee /dev/tty??? > > Well, I have done this and am still having problems getting everything > to the device(s). The trick I saw to do this recently really made me sit up and take notice... The "teacher" executes the following command: cu XXXX | tee /tmp/tmpfile where XXX is a phone number or machine name for the computer to be demonstrated (this may result in logging in to the same machine running the cu command, but not necessarily). The "students" run tail -f /tmp/tmpfile I don't totally understand why this works, but it does. You can even see all the "teacher's" key strokes in real time. -- Peter Fales AT&T, Room 5B-420 N9IYJ 2000 N. Naperville Rd. UUCP: ...att!peter.fales Naperville, IL 60566 Domain: peter.fales@att.com work: (312) 979-8031
cpcahil@virtech.uucp (Conor P. Cahill) (11/10/89)
In article <4647@cbnewsc.ATT.COM>, psfales@cbnewsc.ATT.COM (Peter Fales) writes: > cu XXXX | tee /tmp/tmpfile > > [text deleted...] > > tail -f /tmp/tmpfile > > I don't totally understand why this works, but it does. You can even > see all the "teacher's" key strokes in real time. The reason that this works is that cu starts up two programs, one that takes all of you're keyboard input and writes it out the communications port and one that reads all of the data comming in the comm port and writes it to stdout. In your example stdout is the tee, which copies the data to the logfile and writes it to the terminal. Since the data is being written to the log file, the students that read the log file will see all data comming from the comm port. You don't see all of the teacher's keystrokes, you see all of the data ouput from the system to the terminal. Many of the teacher's keystrokes are echoed back by the system so that is why you see most of them. -- +-----------------------------------------------------------------------+ | Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 ! | Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 | +-----------------------------------------------------------------------+
tom@ismdqa.intel.com (Tom Soukup ~) (11/12/89)
In article <4647@cbnewsc.ATT.COM> psfales@cbnewsc.ATT.COM (Peter Fales) writes: >In article <256@telxon.UUCP>, dank@telxon.UUCP (Dan Kelley) writes: >> I am looking for an idea to duplicate output on different terminals. >The "teacher" executes the following command: > cu XXXX | tee /tmp/tmpfile >The "students" run > tail -f /tmp/tmpfile >I don't totally understand why this works, but it does. You can even >see all the "teacher's" key strokes in real time. This works because tail -f writes the contents of the file to the standard output (the screen) and then waits. As additional characters are put into the file, tail -f continues writing them to the screen. It will continue waiting forever (I think) unless interupted. So the cu | tee copies everything that the cu echos into tmpfile and the tail prints everything that goes into tmpfile on thr students screen. Good idea, I wish I'd thought of it :-). >Peter Fales AT&T, Room 5B-420 Tom ________________________________________________________________________________ DISCLAMER: Intel doesn't agree with much of anything that I say. UUCP: {amdcad,decwrl,hplabs,oliveb,pur-ee,qantel}!intelca!mipos3!ismdqa!tom ARPA: tom%ismdqa.intel.com@relay.cs.net CSNET: tom@ismdqa.intel.com
mercer@ncrcce.StPaul.NCR.COM (Dan Mercer) (11/13/89)
In article <353@bilver.UUCP> bill@bilver.UUCP (Bill Vermillion) writes: :In article <256@telxon.UUCP-> dank@telxon.UUCP (Dan Kelley) writes: :-> :->I am looking for an idea to duplicate output on different terminals. :->Obviously, the choice at first is easy, just use the "tee" program :->in this manner: :-> program | tee /dev/tty??? :-> :->Well, I have done this and am still having problems getting everything :->to the device(s). Seems when I run something like a database package, :->I do not get the duplication as I should. In fact, I do not get the :->proper I/O from the program on my own tty. Seems "tee" is not dealing :->with I/O properly and there also may be a buffering problem. : :How about a hardware solution, and take the output going to terminal A and put :it to terminal B through a diode. : :I had a serial board fail in the mode. So that anthing on A went to A & B, :but anything directed to B stayed at B. : : : :-- :Bill Vermillion - UUCP: {uiucuxc,hoptoad,petsd}!peora!tarpit!bilver!bill : : bill@bilver.UUCP In order for tee to work, the program must use stdout and stderr for output. Vi and many other programs require a terminal, so thet open /dev/tty directly. If they are using rawmode input and output, they frequently will do ioctl against stdin, stdout or stderr. If this is a pipe, it will fail (but few people have the sense to check for the failure) and your machines termio will be all screwed up. I had to demo a programming environment that used a rawmode menuing system laid over vi. Consequently, tee would not work. Cu could not handle the high speed of the lines and the large number of rawmode transactions. So I rolled my own, called demo2tty. I can mail it to you if you like. Standard disclaimers apply (SysVr1). To all the net.policeman objecting to this type of entry, may I remind you that management looks askance at any alt groups appearing on the net, and many of us do not have alt.sources.d. -- Dan Mercer Reply-To: mercer@ncrcce.StPaul.NCR.COM (Dan Mercer)
mercer@ncrcce.StPaul.NCR.COM (Dan Mercer) (11/13/89)
I forgot to add to the last article, the use of /dev/tty by many programs makes programs that log out users logged in but not working almost impossible to implement. We're using one on our news machine that has timed me out several times while transferring files using kermit and once while editting a long article in vi. (that was the worst, cause vi didn't hang up and when I logged back on I got into vi when the machine was supposed to be asking for the dialup password. The times for /dev/tty get updated, of course, not the times for /dev/ttyxx. -- Dan Mercer Reply-To: mercer@ncrcce.StPaul.NCR.COM (Dan Mercer)
drm@gaia.oz (David Moline) (11/16/89)
In article <1703@ncrcce.StPaul.NCR.COM>, mercer@ncrcce.StPaul.NCR.COM (Dan Mercer) writes: > In article <353@bilver.UUCP> bill@bilver.UUCP (Bill Vermillion) writes: > :In article <256@telxon.UUCP-> dank@telxon.UUCP (Dan Kelley) writes: > :-> > :->I am looking for an idea to duplicate output on different terminals. A while back I wanted something that did the same thing. After looking and asking I found an article in Unix World (May 87 - Page 91 & following) that did everything that I wanted and more. The shell script in the artilce is designed to help remote debugging. So that everything you type on your terminal shows on the other, and everything typed on the other screen shows on the local terminal. It also give a shell script to 'show' a group of people. The author of the scripts was George P. Smith from Mountain Bell. I think from memory that the script as written would not run a Sun 3/60 runnning 3.5 of SunOS but was easily modified. I hope this is of use. -- David Moline - Graphics Computer Systems, 260 High St, Kew, 3101, AUSTRALIA Phone: (03) 862 2511 Fax: (03) 862 2092 ACSNET: drm@gaia.oz UUCP: ..!uunet!murtoa!gaia!drm ARPA: drm%gaia.oz@uunet.uu.net