Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Your Senior said:...said i should use the [tt]rsh[/tt] command in my script, to get a list of printers using [tt]lpstat -v[/tt] command.
device for 0101a01: lpd://172.25.41.111:515
device for 0101a02: lpd://172.25.25.58:515
device for 0101a03: lpd://172.25.41.135:515
device for 0101a04: lpd://172.25.41.195:515
device for 0101a05: lpd://172.25.41.133:515
device for 0101a01: lpd://172.25.41.111:515
device for 0101a02: lpd://172.25.25.58:515
device for 0101a03: lpd://172.25.41.135:515
device for 0101a04: lpd://172.25.41.195:515
device for 0101a05: lpd://172.25.41.133:515
function printerExists()
{
if [ $# -ne 1 ]; then
echo "Incorrect parameters"
return 0
else
lpstat -p | awk '{print $2}' | while read printer
do
if [ $1 = "${printer}" ]; then
return 1
fi
done
fi
}
# Printer Name cannot Include any spaces
prName="formalName"
# User friendly printer name"
prDescription="Printer Name"
# Location
prLocation="Home Office"
# IP Address of printer
prAddress="192.168.1.99"
# PPD Filename... assumes it is installed on machine
prPPD="HP LaserJet 2200.gz"
#Test If Printer is already installed
printerExists $prName
prExists=$?
if [ $prExists -eq 1 ]; then
echo "Printer already exists. Skipping: \"$prName\""
else
# Add Printer Command
lpadmin -p "${prName}" -D "${prDescription}" -L "${prLocation}" \
-E -v lpd://"${prAddress}" -P "/Library/Printers/PPDs/Contents/Resources/en.lproj/$prPPD" \
-o HPOption_Duplexer=True -o Resolution=1200x1200dpi
fi
LOCAL_FILE=`/usr/lbin/lpstat -v >> sun5-printers.txt
REMOTE_FILE=`rsh sun8 /usr/lbin/lpstat -v >> sun8-printers.txt
awk 'BEGIN {while ( getline < "sun5-printers.txt") {arr[$0]++ }}{ if (!($0
in arr ) ) {print} }' sun8-printers.txt
device for 0117bd1: lpd://172.25.29.60:515
device for 2201bl7: socket://172.25.11.170:9100
#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