Saturday, March 23, 2013

Add new printer queue on solaris server using lpadmin command


Add new printer queue on solaris server using lpadmin command

Add new printer queue on solaris server using lpadmin command
1.) Add printer name and port details on /etc/printers.conf file
Eg:
mtysap:\
:bsdaddr=mtyun118,mtysap,Solaris:

mtysapq:\
:bsdaddr=mtysun118,mtysapq,Solaris:

mtysapt:\
:bsdaddr=mtysun118,mtysapt,Solaris:

In above mtysap is Print queue name and mtysun118 is Server name.
2.) Copy the existing interface configuration file to new printer name
Eg:
cp /etc/lp/interfaces/mtysap /etc/lp/interfaces/mtysaptest

3.) Copy the existing configuration file from file to new printer name
Eg:
mkdir /etc/lp/printers/mtysaptest
cp –p /etc/lp/printers/ mtysap/* /etc/lp/printers/mtysaptest
ls –l /etc/lp/printers/mtysaptest
total 10
-rwxrwx--- 1 lp lp 1347 Aug 2 2006 alert.sh
-rw-rw---- 1 lp lp 4 Aug 2 2006 alert.vars
-rw-rw-r-- 1 lp lp 168 Aug 2 2006 configuration
-rw-rw-r-- 1 lp lp 16 Aug 2 2006 faultMessage
-rw-rw-r-- 1 lp lp 0 Aug 2 2006 users.deny

4.) Edit new printer configuration file and replace the IP address with IP of your network printer
Eg:
vi /etc/lp/printers/mtysaptest/configuration

# cat /etc/lp/printers/ mtysaptest /configuration
Banner: on
Content types: any
Device: /dev/null
Interface: /usr/lib/lp/model/netstandard
Printer type: unknown
Modules:
Options: protocol=tcp,dest=134.200.172.26:9100

5.) Change the ownership of files
chmod 775 /etc/lp/interfaces/ mtysaptest
chown lp:lp /etc/lp/interfaces/ mtysaptest
chown-R lp:lp /etc/lp/printers/mtysaptest

6.) Create and enable the printer
eg:
lpadmin -p mtysaptest -v /dev/null -i /etc/lp/interfaces/ mtysaptest
accept mtysaptest
enable mtysaptest

7.) Check the new printer status
Eg:
# lpstat -p mtysaptest

printer mtysaptest is idle. enabled since Fri 28 Jan 2011 01:47:21 PM GMT. available.

Note : Another way you can also run below script after adding printer in /etc/printers.conf

#!/bin/ksh
# execute the script followed by the printer name and IP.
/usr/sbin/lpadmin -p $1 -v /dev/null -A write -i /usr/lib/lp/model/ne
tstandard -o dest=$2 -o protocol=bsd -o nobanner -I simple,postscript -u allow:all
/usr/bin/enable $1
/usr/sbin/accept $1
echo "Printer "$1" created!"
echo "Printer configuration..."
/usr/bin/lpstat -lp $1
exit

No comments:

Post a Comment