Sponsored Content
Top Forums Shell Programming and Scripting Help with script to create printers on unix Post 302419481 by ggoliath on Friday 7th of May 2010 09:49:30 AM
Old 05-07-2010
herewith is the current code:
Code:
#!/bin/ksh
BIN=/usr/lbin/
LOCAL_FILE=`$BIN/lpstat -v >> sun5-printers.txt
REMOTE_FILE=`rsh sun8 /usr/lbin/lpstat -v >> sun8-printers.txt
DIFF_FILE=/usr/local/bin/diff.txt
awk 'BEGIN {while ( getline < "sun5-printers.txt") {arr[$0]++ }}{ if (!($0
 in arr ) ) {print} }' sun8-printers.txt >> diff.txt
while read printer
do
printer="$(echo $printer | cut -d: -f1)"
echo $printer
done < diffs.txt
exit 0
#Amend,create or delete Printer
f_Delete()
{
 if [ $printer -eq 1 ]; then
      echo "\n\t printer to be deleted"
      else 
      $BIN/lpadmin -x $Printer
      echo "\n\t Deleting printer $Printer !!!"
 fi
}
f_Create()
{
  if [ $printer -eq 0 ]; then
  echo "Enter Printer Name: \c"
  read printer
  echo "Enter IP Address  : \c"
  read ip
  echo "Enter Location    : \c"
  read loc
  echo "Enter Description : \c"
  read desc
  echo "Enter Filter      : \c"
  read filt
  echo "Enter Port        : \c"
  read port
  echo "Enter Driver      : \c"
  read driv
  echo "\n\t Printer does not exists. "
  else 
  $BIN/lpadmin -p "$Printer" -E -D "$Desc" -L "$Loc" -i /u1/cups/mac/"$Filt"_filter -v \
  "$driv"://"$IP":"Port"
  echo "\n\t Printer $printer created"
 fi
}

what about debugging????Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

quering unix boxes for attaced printers

Greetings All, I was wanting some info seeing i am a ms geek looking to go into UNIX if i want to query a UNIX box for info regarding printers, LPDs and such source how would i go about this !!!! All comments that would point me in the right direction would be most useful. Cheers (1 Reply)
Discussion started by: seekerO
1 Replies

2. Shell Programming and Scripting

How To create Flat Files using Unix Shell Script?

Hi all, How to create Flat Files using Unix Shell Script. The Script is supposed to be sheduled to run at a particular time? Thanks in advance Appu (4 Replies)
Discussion started by: Aparna_k82
4 Replies

3. UNIX for Advanced & Expert Users

Password protect UNIX printers?

Is there a way to password protect a printer that is on a LAN network? Our security officer said our UNIX printers need to be password protected. Is this possible? I am running Solaris 7 and 8... Thanks in advanced for any suggestions. (4 Replies)
Discussion started by: rtoba
4 Replies

4. Shell Programming and Scripting

Script for reporting network printers

Does anyone have a script that would detect (and create a flat-file) of all printing devices (printers/plotters) attached on a network? I need a single script or tool that would allow me to collect a data file for our asset management tool. Example format: manufacturer, model name, serial... (0 Replies)
Discussion started by: glefko
0 Replies

5. Shell Programming and Scripting

How to create xls file using unix script

Hi All, I want to create an xls file using shell script. I mean that I have written one script. It is having sql output. So I want to save that sql output into one xls file and I want to send that file as a attachment to my team MAIL_IDs. Can You any guy help me in this? Thanks in... (3 Replies)
Discussion started by: raghu.iv85
3 Replies

6. Shell Programming and Scripting

How to create a file with full permission in unix script

In my script, I am creating a file ----> then writting one line (i.e. Timestamp) ----> then FTP'ing. The same script can be executed by many other users. While other users executing this script, they couldn't Over write this one line (i.e. Timestamp) My expectation So I wanted to create a... (2 Replies)
Discussion started by: sbmk_design
2 Replies

7. AIX

AIX Bunch of printers queue creation script - HELP

I'd seek for help on how to create a bunch of printers in AIX 6.x or equal or above in one go – say like I have 35 printers to create in 4 different AIX Nodes every month – I currently create it manually like below:- How can I automatic this creation on all the 4-5 Nodes – not actually automatic... (3 Replies)
Discussion started by: shiv2001in
3 Replies

8. UNIX for Dummies Questions & Answers

Unix script to create a backup on a remote computer

Hello, I have a problem - I attended a UNIX course a couple of years back but, unfortunately, I don't remember how to write scripts for shell commands. Now I want to make a script that makes a backup of a folder on a remote computer and I have no idea how to begin. :D So the idea is that I want... (3 Replies)
Discussion started by: Benedit
3 Replies

9. Shell Programming and Scripting

Need a script to add mutiple printers in solaris box

Hi , i need to configure around 80 printers in a server. can someone please help me with the script. i have a file that has printer name and its ip. like. printer1 1.1.1.1 printer2 0.0.0.0 and so on.. can some one please help me to do it via script. i am using solaris 10 ... (0 Replies)
Discussion started by: chidori
0 Replies

10. Shell Programming and Scripting

Create a UNIX script file with multiple commands

Hi Good morning all, I want to create script file with multiple commands. For ex: pmrep connect is one of the command to connect to repository. pmrep objectexport is another command to export objects to a file. These commands should run sequentially.But when i try to execute this, the first... (4 Replies)
Discussion started by: SekhaReddy
4 Replies
printers.conf(5)						    Apple Inc.							  printers.conf(5)

NAME
printers.conf - printer configuration file for cups DESCRIPTION
The printers.conf file defines the local printers that are available. It is normally located in the /etc/cups directory and is generated automatically by the cupsd(8) program when printers are added or deleted. Each line in the file can be a configuration directive, a blank line, or a comment. Comment lines start with the # character. DIRECTIVES
<Printer name> ... </Printer> Defines a specific printer. <DefaultPrinter name> ... </Printer> Defines a default printer. Accepting Yes Accepting No Specifies whether the printer is accepting new jobs. AllowUser [ user @group ... ] Allows specific users and groups to print to the printer. DenyUser [ user @group ... ] Prevents specific users and groups from printing to the printer. DeviceURI uri Specifies the device URI for a printer. ErrorPolicy abort-job ErrorPolicy retry-current-job ErrorPolicy retry-job ErrorPolicy stop-printer Specifies the error policy for the printer. Info text Specifies human-readable text describing the printer. JobSheets banner banner Specifies the banner pages to use for the printer. KLimit number Specifies the job-k-limit value for the printer. Location text Specifies human-readable text describing the location of the printer. OpPolicy name Specifies the operation policy for the printer. PageLimit number Specifies the job-page-limit value for the printer. PortMonitor monitor Specifies the port monitor for a printer. QuotaPeriod seconds Specifies the job-quota-period value for the printer. Shared Yes Shared No Specifies whether the printer is shared. State idle State stopped Specifies the initial state of the printer (Idle or Stopped) StateMessage text Specifies the message associated with the state. StateTime seconds Specifies the date/time associated with the state. SEE ALSO
classes.conf(5), cupsd(8), cupsd.conf(5), mime.convs(5), mime.types(5), http://localhost:631/help COPYRIGHT
Copyright 2007-2011 by Apple Inc. 29 April 2009 CUPS printers.conf(5)
All times are GMT -4. The time now is 07:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy