Sponsored Content
Operating Systems HP-UX Script to find what netprinters are configured with what model Post 302658531 by rwuerth on Tuesday 19th of June 2012 11:01:40 AM
Old 06-19-2012
Script to find what netprinters are configured with what model

Moderator's Comments:
Mod Comment
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 12:34 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Model script related question

Hey fellow bit pushers, I have been seeing an odd problem on a few of my systems and was wondering if any of you have seen it on your systems and possibly know why it happens. We have a custom model script for a printer on our systems. This model script is just a standard ksh script... (2 Replies)
Discussion started by: TioTony
2 Replies

2. Slackware

LDAP not getting configured!!!

hi, i m tryin to learn ldap. but its not getting configured. the error msg it shows is: LDAP configure error: BDB/HDB : Berkeley DB version incompatibe. The BDB version i have installed is bdb4.2.52 and the ldap version is openldap-2.3.12. my machine is running on red hat linux 9. Why... (1 Reply)
Discussion started by: mridula
1 Replies

3. UNIX for Advanced & Expert Users

Command to find Hardware model in Solaris

Hi, I need a command to find the Hardware Model in Solaris 8,9,10,11. The command which I am using right now is: /usr/platform/`uname -i`/sbin/prtdiag The problem is in this output:- System Configuration: Sun Microsystems sun4u Netra T1 200 (UltraSPARC-IIe 500MHz) Here I am... (1 Reply)
Discussion started by: vineetd
1 Replies

4. Solaris

Solaris10 x86 - How to find out the CPU model and speed?

Please let me know if there is any way I can find out (either via command line or SMF) the following: 1.CPU model (eg. Pentium 4,Celeron) 2.CPU speed (eg. 1GHz) for this I could get the output through psrinfo -v, but still is there any other way? 3.Hard disk model (eg. Seagate). When I... (9 Replies)
Discussion started by: saagar
9 Replies

5. UNIX for Dummies Questions & Answers

How to find which raid is configured(without restart)

Is there a way to find the raid type without restarting the machine? I m using linux operating system. (3 Replies)
Discussion started by: pinga123
3 Replies

6. Red Hat

How to Find what HBA is configured on Linux?

Hi I am working in an environment where there are many redhat physical and virtual machines, mostly Redhat 4. These servers have LUNs attached. The external storage can be EMC, NetApp or Par3. My question is that when Storage Administrator informs that a new LUN has been presented to a... (4 Replies)
Discussion started by: Tirmazi
4 Replies

7. Solaris

uname -i question (trying to find model)

Hello, im trying to find the models of all the systems on my network. I am going to right a script to ssh in and execute the uname -i command. It works but doesnt tell me the model but rather something else. Is there a better command to get the model of your workstation? Command using: uname... (2 Replies)
Discussion started by: whotippedmycow
2 Replies

8. IP Networking

IP not configured is being used to login

Hi have a solaris server with the following IP 192.168.0.85, but anybody can login in using 172.19.0.85, and the ifconfigcommand does not show the 172.19.05 . # ifconfig -a lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1 inet 127.0.0.1 netmask... (6 Replies)
Discussion started by: fretagi
6 Replies

9. SuSE

How to find Server model in Suse?

How to find Server model in Suse? dmidecode is not working here server gives output for hwinfo, but not listing lshw,lshal etc. Server is remotely located, so I cant find it physically. dmesg command is also not helping with boot logs. I am not a Suse admin, request fast reply. Thanks Shyam (6 Replies)
Discussion started by: shyam2j
6 Replies

10. Debian

Dhcp not getting configured on Ubuntu

I have kali running on vbox as :- /etc/network/interfaces ifup eth0 gives me tpcdump (0 Replies)
Discussion started by: lazerz
0 Replies
All times are GMT -4. The time now is 07:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy