Unix/Linux Go Back    


HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

Script to find what netprinters are configured with what model

HP-UX


Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 06-19-2012
rwuerth rwuerth is offline
Registered User
 
Join Date: Jan 2009
Last Activity: 19 September 2016, 9:39 AM EDT
Posts: 139
Thanks: 13
Thanked 15 Times in 13 Posts
Script to find what netprinters are configured with what model

Moderator's Comments:
Script to find what netprinters are configured with what model
Following this thread :
[Solved] a way to tell printer used by configured print queue?
This is rwuerth's nice contribution!


I had a more complicated script written a long time ago to find out this information,
but after realizing due to VBE's post (thank you VBE) that I could get all the info I
required in one place, I've reworked that into this simple script. Perhaps this will help?


Code:
#!/bin/sh
# hp-ux 11.11
 
# Script will return the IP Address, Model Script and
# the MIO# for all printers configured on the system.
 
# script uses 'eval' to set the variables PERIPH (ip address), MODELSCRIPTNAME
#and PRINTERCFG (mio#) that exist in each printer interface.  If one or more of the
#variables are not found, that information will be left blank, but the printer name
#will be printed.
 
#
# Create Header
#
 
Hptr=PRINTER
HIPA='IP ADDR'
HMOD=Model
HMIO=MIO#
printf '%-10s%-20s%-20s%-10s\n' "$Hptr" "$HIPA" "$HMOD" "$HMIO"
 
IDIR=/etc/lp/interface
 
cd ${IDIR}
 
for ptr in *
do
 if [[ -f $ptr ]]
 then
   # set PERIPH, MODELSCRIPTNAME & PRINTERCFG found in printer interface
   eval $(grep -E "^PERIPH=|MODELSCRIPTNAME=|PRINTERCFG=" $ptr | xargs | tr ' ' ';')
   PRINTERCFG=${PRINTERCFG##*/}
   PRINTERCFG=${PRINTERCFG%%\.cfg}
   printf '%-10s%-20s%-20s%-10s\n' "$ptr" "$PERIPH" "$MODELSCRIPTNAME" "$PRINTERCFG"
   unset -v PERIPH MODELSCRIPTNAME PRINTERCFG
 fi
done
 
cd -


Last edited by vbe; 06-19-2012 at 11:34 AM..
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
uname -i question (trying to find model) whotippedmycow Solaris 2 03-16-2012 05:29 AM
How to Find what HBA is configured on Linux? Tirmazi Red Hat 4 04-06-2011 10:25 AM
How to find which raid is configured(without restart) pinga123 UNIX for Dummies Questions & Answers 3 08-30-2010 09:51 AM
Solaris10 x86 - How to find out the CPU model and speed? saagar Solaris 9 10-12-2009 12:28 PM
Command to find Hardware model in Solaris vineetd UNIX for Advanced & Expert Users 1 04-21-2009 03:25 AM



All times are GMT -4. The time now is 02:28 AM.