Originally posted in comp.unix.shell

Originally posted in comp.unix.shell

Post by Josie Voisien » Fri, 04 Jul 2003 01:15:58



I think maybe this is a more appropriate group
Hello. We have an aix 5x server which is a has a print server running on it. The
printers seem to *up regularly on big print jobs, which shuts down the printer
until I enter the command to restart it. To see which printers are down, I enter:

"enq -qs -A"

and it lists all printers and tells me which ones are down. The output looks like
this
Queue   Dev   Status    Job Files              User         PP %   Blks  Cp Rnk
------- ----- --------- --- ------------------ ---------- ---- -- ----- --- ---






(many more)

To start a printer:
"enable printerx"

Where printer x is the name of the printer.

I have a few questions. How can I expand the output of the the "enq -qs -A" command
to see the fullnames of the printers (they are truncated to  7 characters), and is
it possible for create a script that would load the names of the printers into an
array and restart the ones that are down?

something like:

enq -qs -A (output to an array)
  loop through array
   ( if status = 'down' then
     enable $printer
    )

How do I tell korn what column the status is in?
how do I load variable names for the printers?
I don't know if this can be done in korn or not. This machine does not have the bash
or bourne shell.

Thank you for looking at my problem

 
 
 

Originally posted in comp.unix.shell

Post by johnthomps » Fri, 04 Jul 2003 06:17:59



> I think maybe this is a more appropriate group
> Hello. We have an aix 5x server which is a has a print server running on it. The
> printers seem to *up regularly on big print jobs, which shuts down the printer
> until I enter the command to restart it. To see which printers are down, I enter:

> "enq -qs -A"

> and it lists all printers and tells me which ones are down. The output looks like
> this
> Queue   Dev   Status    Job Files              User         PP %   Blks  Cp Rnk
> ------- ----- --------- --- ------------------ ---------- ---- -- ----- --- ---






> (many more)

> To start a printer:
> "enable printerx"

> Where printer x is the name of the printer.

> I have a few questions. How can I expand the output of the the "enq -qs -A" command
> to see the fullnames of the printers (they are truncated to  7 characters), and is
> it possible for create a script that would load the names of the printers into an
> array and restart the ones that are down?

> something like:

> enq -qs -A (output to an array)
>   loop through array
>    ( if status = 'down' then
>      enable $printer
>     )

> How do I tell korn what column the status is in?
> how do I load variable names for the printers?
> I don't know if this can be done in korn or not. This machine does not have the bash
> or bourne shell.

-W (wide option ) I think works with enq OR lpstat.

-this will restart down'ed queues-- might want to add some error checking i suppose.

for printer in `lpstat |grep DOWN|awk '{ print $1 }'`; do
 enable $printer
 done

- Show quoted text -

Quote:

> Thank you for looking at my problem