[net.unix-wizards] line printer problems

peter (11/12/82)

#N:hp-pcd:9400004:000:1067
hp-pcd!peter    Nov 11 13:08:00 1982


We are running 4.1bsd and have been having some problems lately with the line
printer daemon getting out of sync. The sequence of events is as follows:

   1. the line printer refuses to print
   2. a lock file exists in /usr/spool/lpd that is not owned by the user
      on top of the line printer queue.

To restart the printer, we must do the following:

   1. delete the lock file in /usr/spool/lpd
   2. get the person on top of the queue to restart the daemon /usr/lib/lpd.

I have recompiled and reinstalled all the line printer programs, but it does
not help the situation.

Any suggestions?

                                              Peter Robinson
                                              Hewlett-Packard PCD

                                              ucbvax!hplabs!hp-pcd!peter
                                                      harpo!hp-pcd!peter


P.S. I noticed this morning that using "lprm" to abort a printing listing
     caused the situation to occur. If this is the problem, how does one
     cleanly abort a listing in progress?

shp (11/16/82)

The problem with the lineprinter spooler is that it never closes files.
When the printer is left offline the spooler tries to open the printer
every minute to check the status.  Eventually 15 files are opened, the
spooler aborts on the 16th try and you're left with the lock file
hanging around and the spooler not running.  Make the following changes
to lpd.c and lpf.c and the problem should go away.  It did here at
ittvax.  The change to lpf.c is optional as it only outputs an offline
message to the console.

	- sam praul
	  ...!decvax!ittvax!shp

==========================================
diff /usr/new/src/cmd/lpr/lpd.c /usr/src/cmd/lpr/lpd.c

114d113
< 	fclose(fp);	/* off-line bug fix */
163,164c162
< 		if (send())	{
< 			fclose(dfb);	/* off-line bug fix */
---
> 		if (send())
166d163
< 		}


==========================================
diff /usr/new/src/cmd/lpr/lpf.c /usr/src/cmd/lpr/lpf.c
39d38
< 		console_msg("PRINTER ERROR: OFFLINE");
83d81
< 		console_msg("PRINTER ERROR:  IO ERROR");
323,336d320
< }
< 
< 
< /*  this routine outputs a message to the console 
<  */
< 
< console_msg(message)
< char *message;
< {
< 	FILE *con;
< 
< 	con = fopen("/dev/console","w");
< 	fprintf(con,"%s\n\r",message);
< 	fclose(con);

==========================================