help with function to add printer


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help with function to add printer
# 1  
Old 05-06-2010
help with function

Requirement was to get the differences of printers on the prod server and the dev server
Using the following awk, i was able to get the difference between two files.
Code:
awk 'BEGIN {while ( getline < "sun5-printers.txt") {arr[$0]++ }}{ if (!($0
 in arr ) ) {print} }' sun8-printers.txt

I need to amend the IP address of my printers, so that they can work on my DEV server
I have this function to add the printer using the lpadmin command

Code:
# Printer Name cannot Include any spaces
prName=" "
# IP Address of printer
prAddress=" "
# Location
prLocation=" "
#Description
prdescrip=" "
#filter
prfilter=" "
#Port
prport=" "
#Driver
prdriver=" "
#Amend,create or delete Printer
printerExists $prName
prExists=$?
function printerExists()
{
if [ $prExists -eq 1 ]; then
  echo "Printer already exists. Skipping: \"$prName\""
else
  # Add Printer Command 
  lpadmin -p "${prName}" -E -D "${prDescript}" -L "${prLocation}" -i /u1/cups/mac/"$prFilter_filter -v \
  "$Port"://"${prAddress}":"Prdriver"
fi

Is this correct, if not how can i amend it????Smilie

Last edited by ggoliath; 05-06-2010 at 08:27 AM.. Reason: No reponses, wanted to make my question clearee
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

Unable to add printer in Solaris

HI I am unable to add printer in solaris (architecture is SUN and OS is Solaris 10) as I try to print the file it gives following error Failed to contact service for erp-cljCP2025: not-found Need help Regards (7 Replies)
Discussion started by: smazshah
7 Replies

2. SCO

Cannot add printer to SCO OS 6

:( I am trying to add some printers under SCO OpenServer 6 and everytime I try to open the printer manager it returns a message that reads "Unable to get allowed/denied form users." "Failed to establish user authorizations." When I press the details button is gives me the following Error Details;... (0 Replies)
Discussion started by: RicardoM
0 Replies

3. SCO

steps to add printer

hi, i want help plz i connect my xerox printer under sco os , someone can tell me by steps how i can add it ? what i need to do that ? (2 Replies)
Discussion started by: lid-j-one
2 Replies

4. HP-UX

Add printer using hppi

I would like to add printer using hppi. The printer is shared by windows print server and the IP address is shown as 10.0.30.66-1. (IP 10.0.30.66 using printer port 1) I have added printer with IP 10.0.30.66, but it shows errors for print test. Sending a test file to 4050SA ... ... (3 Replies)
Discussion started by: alfredo
3 Replies

5. UNIX for Dummies Questions & Answers

Want to add a new printer to AIX

Hello. I would like to add an HP printer to my AIX (5.2) system. The printer is attached to a Windows PC via LPT1. We are using Novell as our LAN :) I am somewhat familiar with SMIT and printer queues. Still a bit of a newbie. I would like to be able to print from the AIX directly to... (0 Replies)
Discussion started by: MILLERJ62
0 Replies

6. UNIX for Dummies Questions & Answers

add printer

Helooo I am trying to add a printer in sco unix but i found only serial ports how to define parallel ports? Regards (1 Reply)
Discussion started by: sak900354
1 Replies

7. UNIX for Dummies Questions & Answers

Add printer with IP address with lpadmin

Hi all, I'm tryin' to add a network printer with lpadmin (I don't have access to admintool) to a Solarisbox but I don't exactly know where to use the IP address. The thing is that this printer exists already with another printQ but I don't see any printerserver declared with lpsystem -l although... (3 Replies)
Discussion started by: nulnul7
3 Replies

8. HP-UX

add printer on serial port

I want to add printer on a serial port can I get full details of all parameters like baudrate, parity,flow control, ... Thanks (1 Reply)
Discussion started by: Hegazy Mahdy
1 Replies

9. UNIX for Dummies Questions & Answers

Add Windows Printer

I have next to no knowledge of Unix, but have managed to do most of what I've needed to so far. I'm stuck however on adding a printer to the list of Unix printers that is a network printer. I have no printers connected directly to my Unix box, but need to be able to print from an application,... (1 Reply)
Discussion started by: boydnapier
1 Replies
Login or Register to Ask a Question