[cups.general] [offtopic] Incomplete data received withscripted netcat that emulates a JetDirect printjob receiver

Gene Heskett gene.heskett at verizon.net
Sun Jun 8 10:24:21 PDT 2008


On Sunday 08 June 2008, Kurt Pfeifle wrote:
>> On Sat, Jun 07, 2008 at 08:41:24PM -0700, Kurt Pfeifle wrote:
>> > If I remove the "&" from the listener-watchdog call in the "rc-listener"
>> > startup script, that script does not return the shell console to me.
>> > However, if I use "^Z;bg" to put it into the background, it works
>> > perfectly, and all data arrive without fail.
>> >
>> > I'm at my wits' end. It seems to be connected to the mentioned
>> > backgrounding of the "listener-watchdog" call inside the "rclistener"
>> > script.
>> >
>> > Why...
>> >    ...does putting that one line directly into the background inside
>> >       the script *not* work,
>> >    ...while calling it normally, but instead putting the whole script
>> >       manually into the background work
>>
>> Instead of using a script in /etc/init.d/, couldn't you edit your
>> /etc/inittab file and put this line at the bottom :
>>
>> --- CUT ---
>> lw:2345:respawn:/usr/local/bin/listener-wrapper >/tmp/log 2>/tmp/err
>> --- CUT ---
>>
>> Then do a :
>>
>>         telinit q
>>
>> This will replace both your rc-listener script and your watchdog,
>> elimintating in the process potential sources of problems.
>
>I've not yet tested it (on Solaris), but from reading the telinit and
> inittab (Linux) man pages it looks like there could be problems with the
> "respawn" feature:
>
>      If init finds that it is continuously respawning an entry more
>      than 10 times in 2 minutes, it will assume  that  there  is an
>      error in the command string, generate an error message on the
>      system console, and refuse to respawn this entry until either 5
>      minutes has elapsed or it receives a signal.
>
>Since netcat does terminate when a connection ends, and I expect the arrival
> of jobs being frequently in a rate of "10 times in 2 minutes", this may not
> be a reliable way to achieve what I want...
>
>But thanks anyway for the suggestion. I'll test it on Solaris regardless
> what the Linux man page says.

Kurt:  Can bash read from a port like it can from hardware?  If so, I may have 
something you could adapt.

I keep some 'legacy hardware' around here, a heavily modified trs-80 Color 
Computer 3, with a Hitachi 63C09 cpu and 2 megs of dram in it.  I recently felt 
the need for a printer on it, but found all my old printers disabled for 1 
reason or another, mostly because the film ribbons were too old & fragile & 
another box of those was more than a Brother 2140 laser at Staples.

So with some help from Jon LaBadie, we cobbled up a couple of scripts, one to 
watch /dev/ttyUSB1 & cache the incoming data, and one to print it back to the 
Brother sitting on top of the coco3 desk when the data stopped coming in for a 
few seconds which I used for the EOF indicator.  The script does some 
housekeeping generally involved with keeping the last x jobs and re-using the 
job filenames ala circular buffer usage.

For me, 100 was more than enough, but there is no real reason other than storage 
space for the cached data not to take that to 10,000 or so for a busy system.

If interested, contact me off-list, no use boring everyone here with 5 pages of 
2 bash scripts.

>Cheers,
>Kurt
>_______________________________________________
>cups mailing list
>cups at easysw.com
>http://lists.easysw.com/mailman/listinfo/cups



-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Never appeal to a man's "better nature."  He may not have one.
Invoking his self-interest gives you more leverage.
		-- Lazarus Long





More information about the cups mailing list