👤
Home Man
Search
Today's Posts
Register

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

👤 Login to reply

 
Thread Tools Search this Thread
# 1  
Old 06-19-2012
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 :
https://www.unix.com/hp-ux/189023-sol...int-queue.html
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..
👤 Login to reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Dhcp not getting configured on Ubuntu lazerz Debian 0 04-20-2016 03:08 AM
How to find Server model in Suse? shyam2j SuSE 6 08-25-2014 08:59 AM
IP not configured is being used to login fretagi IP Networking 6 08-15-2014 08:41 AM
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
LDAP not getting configured!!! mridula Slackware 1 11-28-2005 04:27 AM
Model script related question TioTony UNIX for Advanced & Expert Users 2 10-17-2001 10:35 AM


All times are GMT -4. The time now is 03:10 AM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
×
UNIX.COM Login
Username:
Password:  
Show Password