Question

How To Print To Print Server From Shell

Asked by: coppsbuildall

Hi,

I would like to send a print job from the shell to a network printer. We are currently using this script to print to serial line printers and it works great. However recently we have started adding print servers to the printers in an effort to get rid of the serial port server.

I have attached the script below. The files that it reads in just has a six digit number in it ... and it is incremented after every print.

Any advice on how to modify the script to print to a network print server would be greatly appreciated.

Thanks!

:
# DoubleVision Pro's digiboard call during login...
[ -x /usr/lib/dv/digi_trigger ] && /usr/lib/dv/digi_trigger
# The following script completes this objective:
 
# Create pre-printed invoices for manual use with either cash or account sales
# Limit invoice # to 6 digits and qty per batch print to 250.
# Also, make it easy to cancel
# Prevent collision of temporary files
 
# v970730
# Co-Written by W. Travis Peters on 97/07/29
# Co-Written by Scott A. Johnston on 97/07/30
PATH=/tools.aix/nullout:/opt/K/SCO/Unix/5.0.6Ga/tcb/bin:/bin:/pm/bin:/bin:/etc:/usr/bin:/tcb/bin
export PATH
 
newfile=`date | cut -c12-13,16-16,18-19`
 
# The following loop asks for a location number and verifies it. If the 
# location number is wrong, it loops and asks for it again. "q" will abort
# the whole script and exit the program
 
while :
do
clear
echo
echo
echo " This program will print 1 to 250 manual forms for Received on Accounts"
echo " and Manual Sales Orders. You may enter \"q\" at any time to quit.\n" 
echo " This program will keep track of your invoice numbers for you.\n" 
echo " Please answer the following questions:\n\n"
echo "\tPlease Enter Location # (1-6): \c"
read locat
if [ $locat ] 
then
	if [ $locat -lt 1 ]
	then
		case $locat in
		[QqCcXx])
			echo "\n\tPRINT JOB CANCELLED, press RETURN to EXIT...\c"
			read junk
			exit;;
		*)
			echo "\n\tLocation $locat is invalid, press RETURN to continue...\c"
			read junk;;
		esac 
	else
		if [ $locat -gt 6 ]
		then
			echo "\n\tLocation $locat is invalid, press RETURN to continue...\c"
			read junk
		else
			if [ $locat -lt 10 ]
			then
			case $locat in
			00*)
				echo "\n\tLocation $locat is invalid, press RETURN to continue...\c"
				read junk
				continue;;
			
			1)
				locat="01";;
			2)
				locat="02";;
			3)
				locat="03";;
			4)
				locat="04";;
			5)
				locat="05";;
			6)
				locat="06";;
			esac
			fi
			break
		fi
	fi    
fi
done
 
# The following asks for and verifies the quantity between 1 and 250. If the
# user presses return without a quantity, we simply ask for a quantity again
# until the user presses "q" or puts in a valid quantity.
 
while :
do
clear
echo
echo
echo " Please enter the quantity to print. The quantity allowed is 1 to 250"
echo " forms per batch. This will keep print times to a minimum and will "
echo " not tie up the printer for any great length of time. Figure about 1"
echo " second print time per form. The maximum print time would then be about"
echo " 4 minutes to complete.\n\n"
echo "\tPlease enter the quantity to print (1-250): \c"
read qty
if [ $qty ]
then
	if [ $qty -lt 1 ]
	then
		case $qty in
		[QqXxCc])
			echo "\n\tPRINT JOB CANCELLED, press RETURN to EXIT...\c"
			read junk
			exit;;
		*)
			echo "\n\tYou have entered an invalid quantity, press RETURN to continue...\c"
			read junk;;
		esac
		continue
	else
		if [ $qty -gt 250 ]
		then
			echo "\n\tYou have entered to many, press RETURN to continue...\c"
			read junk
			continue
		else
			break
		fi
	fi
else
	echo "\n\tYou must enter a quantity, press RETURN to continue...\c"
read junk
fi
done
 
while :
do
clear
echo
echo
echo " Now you must select a form type to print.\n" 
echo " Manual Sales Orders are for power failures etc.."
echo " Received on Account forms are for receiving payments at the till.\n\n"
echo "\tForm Type:\n" 
echo "\t    1) Manual Sales Order form\n"
echo "\t    2) Received on Account form\n\n"
echo "\t    Please enter form type: \c"
read type
case $type in
[1])
	type="***SALES MANUALS***"
	formtype="1"
	break;;
[2])
	type="***RECEIVED ON ACCOUNT***"
	formtype="2"
	break;;
[QqXxCc])
	echo "\n\tPRINT JOB CANCELLED, press RETURN to EXIT...\c"
	read junk
	exit;;
*)
	echo
	echo 
	echo "Incorrect selection, press RETURN to continue...\c"
	read junk
	continue;;
esac
done
 
 
case $locat in
 
	01)
		printer="/dev/ttya03"
		if [ $formtype -eq "1" ]
		then
			starting=`cat dtsales`
			startfile="dtsales"
		else
			starting=`cat dtroa`
			startfile="dtroa"
		fi
		break;;
	02)
		printer="/dev/ttyd22"
		if [ $formtype -eq "1" ]
		then 
			starting=`cat lasales`
			startfile="lasales"
		else
			starting=`cat laroa`
			startfile="laroa"
		fi
		break;;
	03)
		printer="/dev/ttyd16"
		if [ $formtype -eq "1" ]
		then
			starting=`cat forestsales`
			startfile="forestsales"
		else
			starting=`cat forestroa`
			startfile="forestroa"
		fi
		break;;
	04)
		printer="/dev/ttyb11"
		if [ $formtype -eq "1" ]
		then
			starting=`cat hpsales`
			startfile="hpsales"
		else
			starting=`cat hproa`
			startfile="hproa"
		fi
		break;;
	05)
		printer="/dev/ttyc03"
		if [ $formtype -eq "1" ]
		then
			starting=`cat lesales`
			startfile="lesales"
		else
			starting=`cat leroa`
			startfile="leroa"
		fi
		break;;
	06)
		printer="/dev/ttya04"
		if [ $formtype -eq "1" ]
		then
			starting=`cat fcsales`
			startfile="fcsales"
		else
			starting=`cat fcroa`
			startfile="fcroa"
		fi
		break;;
esac
 
while :
do
clear
echo
echo " You have selected the following options:\n"
echo "\tLocation:    $locat"
echo "\tQuantity:    $qty"
echo "\tStarting at: $starting"
ending=`expr $starting + $qty - 1`
echo "\tEnding at:   $ending"
echo "\tForm Type:   $type"
echo "\tPrinter:     $printer"
echo 
echo " ***IMPORTANT***"
echo " Make sure no one prints an invoice or order to this printer as the two"
echo " print jobs will collide and both will be ruined and will need to be "
echo " reprinted. It is recommended that you complete this job at a time when"
echo " there is no risk of anyone printing an invoice or order!"
echo 
echo "\tOptions:\n"
echo "\t1) Cancel Print Job"
echo "\t2) Change Printer"
echo "\t3) Accept and Print"
echo "\n\tEnter Choice: \c"
read okay
case $okay in
[1CcQqXx])
	echo "\n\tPRINT JOB CANCELLED, press RETURN to EXIT...\c"
	read junk
	exit;;
2)
	while :
	do
	clear
	echo
	echo
	echo " You must enter the printer device name correctly. "
	echo " The printer you choose must be a printer with the"
	echo " invoice forms loaded and aligned in the usual manner.\n"
	echo " Examples are:\n"
	echo "\tttya03\tttyb16\n"
	echo " Please enter printer device to print to: \c"
	read newprinter
	case $newprinter in
	
	[CcQqXx])
		echo "\n\tPRINT JOB CANCELLED, press RETURN to EXIT...\c"
		read junk
		exit;;
	lp00)
		printer="/dev/$newprinter";break;;
	ttya15)
		printer="/dev/$newprinter";break;;
	ttya23)
		printer="/dev/$newprinter";break;;
	ttya24)
		printer="/dev/$newprinter";break;;
	ttya25)
		printer="/dev/$newprinter";break;;
	ttyb16)
		printer="/dev/$newprinter";break;;
	ttya29)
		printer="/dev/$newprinter";break;;
	ttyd20)
		printer="/dev/$newprinter";break;;
	ttyd16)
		printer="/dev/$newprinter";break;;
	ttyd23)
		printer="/dev/$newprinter";break;;
	ttyd24)
		printer="/dev/$newprinter";break;;
	ttyb08)
		printer="/dev/$newprinter";break;;
	ttyb12)
		printer="/dev/$newprinter";break;;	
	ttyb13)
		printer="/dev/$newprinter";break;;
	ttyb14)
		printer="/dev/$newprinter";break;;
	ttyb15)
		printer="/dev/$newprinter";break;;
	ttya03)
		printer="/dev/$newprinter";break;;
	ttyb11)
		printer="/dev/$newprinter";break;;
	ttyb09)
		printer="/dev/$newprinter";break;;
	ttyc02)
		printer="/dev/$newprinter";break;;
	ttyc03)	
		printer="/dev/$newprinter";break;;
	ttyb01)
		printer="/dev/$newprinter";break;;	
	ttyc15)
		printer="/dev/$newprinter";break;;	
	ttyd28)
		printer="/dev/$newprinter";break;;
	laofficeinv)
		printer="/dev/$newprinter";break;;	
	prc11)
		printer="/dev/$newprinter";break;;
	prc09)
		printer="/dev/$newprinter";break;;
	prc06)
		printer="/dev/$newprinter";break;;
	prc07)
		printer="/dev/$newprinter";break;;
		
	*)
		echo
		echo " Invalid printer device, PRINTER NOT CHANGED!\n"
		echo " Press Return to continue...\c"
		read junk
		break;;
	esac
	done
	continue;;
	
3)
	clear
	echo
	echo
	echo "\n\tSpooling Initiated, Please Wait..."
	total=`expr $starting + $qty`
	echo "\030\022\033\0103\00\07" > form$newfile
	while :
	do
 
	echo "\t\t\t\t\t\t\t  $locat  $starting" >> form$newfile
	if [ $locat -eq "06" ]
	then
		echo "   Forest Commodities\n\n\n\n" >> form$newfile
		type="            Packing Slip"
	else	
	 	echo "\n\n\n" >> form$newfile
	fi
	echo "\033\016$type" >> form$newfile
	starting=`expr $starting + 1`
	if [ $starting -lt $total ]
	then
		echo "\014" >> form$newfile
	fi
	if [ $starting -eq $total ]
	then
		echo -n "\014" >> form$newfile
		echo "\tSending forms to printer..."
		cat form$newfile >> $printer
		rm form$newfile
		echo "$starting" > $startfile
		echo "\n\n\n"
		echo "\tForms have been sent."
		echo
		echo "\tYou will now be logged out of this session.\n"
		echo "\tPress RETURN to continue...\c"
		read junk
		exit
	fi
	done
	exit;;
esac
done
 
# DoubleVision Pro's terminal type collector ...
[ -x /bin/termtype ] && /bin/termtype

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-10-30 at 11:43:19ID24859049
Tags

SCO Unix 5.0.7

Topics

SCO Unix

,

Unix Systems Programming

,

Shell Scripting

Participating Experts
2
Points
500
Comments
41

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. shell script / increment a variable
    I am currently trying to write a shell script using vi in Linux Mandrake. I am having a problem with incrementing a variable. ie: $ num=0 $ num=num+1 I have tried various combinations,ie with/without braces and brackets, with without spaces etc. but can not increment num. ...
  2. Access Shell Command Print Statement
    I have a shell command in access that executes a .bat file. The .bat file has a print statement in it that prints a zebra label to a zebra printer (bar code) to printer port: com1. The .bat file executes perfectly when I double click on that. But when I call it from a shell c...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: already_usedPosted on 2009-10-30 at 16:47:13ID: 25707522

Are you adding the network printers as lpr/lpd (remote printers)
Change the script so that the line that actually copies the printfile to the device,( line 379?) is replaced by
"lp -d $printer -c -s $file"
Be sure to use the -c option to prevent the first print queue from deleting the file before the second queue has printed it.
This script looks like it supports about 6 printers.

 

by: mikelfritzPosted on 2009-10-31 at 11:52:52ID: 25711003

You would need to add some logic to handle the existing serial printers until they disappear.  

One way could be to define a print command for each device.

For a tty or non-network spool:
printcmd="cat form$newfile >> $printer"

For network printers:
printcmd="cat form$newfile | lp -d $printer"

Or you could set up all remaining serial printers as spools and then change the script to only use lp on line 379 and change the printer selection steps to define spool name instead of device file.

 

by: coppsbuildallPosted on 2009-10-31 at 12:23:58ID: 25711148

Thanks for the suggestions ... the printers are sitting on the network ... there is very few of them. What I was hoping to do is define the network printers like the serial ones are defined below ... that way when the name of the printer is typed in than it will know it is a network printer and not a serial printer. Can you modify the script to suit?

hpofficei 192.168.2.206
laofficei 192.168.4.206

Keeping in mind that I have no scripting experience ... is it easy to modify the script to work appropriately?

 

by: mikelfritzPosted on 2009-11-01 at 04:37:59ID: 25713519

The modified script below is one way.  It has a new variable named ptype - if ptype=s (for serial) it will act as it always did.  If ptype!=s then it will consider it a spool.  For demo purposes I changed the ttya03 (and location 01) printer to hpofficei spooled printer.  The actual print command now checks to see if ptype=s, if it does it uses cat, else it uses lp.

Mike

:
# DoubleVision Pro's digiboard call during login...
[ -x /usr/lib/dv/digi_trigger ] && /usr/lib/dv/digi_trigger
# The following script completes this objective:
 
# Create pre-printed invoices for manual use with either cash or account sales
# Limit invoice # to 6 digits and qty per batch print to 250.
# Also, make it easy to cancel
# Prevent collision of temporary files
 
# v970730
# Co-Written by W. Travis Peters on 97/07/29
# Co-Written by Scott A. Johnston on 97/07/30
PATH=/tools.aix/nullout:/opt/K/SCO/Unix/5.0.6Ga/tcb/bin:/bin:/pm/bin:/bin:/etc:/usr/bin:/tcb/bin
export PATH
 
newfile=`date | cut -c12-13,16-16,18-19`
 
# The following loop asks for a location number and verifies it. If the 
# location number is wrong, it loops and asks for it again. "q" will abort
# the whole script and exit the program
 
while :
do
clear
echo
echo
echo " This program will print 1 to 250 manual forms for Received on Accounts"
echo " and Manual Sales Orders. You may enter \"q\" at any time to quit.\n" 
echo " This program will keep track of your invoice numbers for you.\n" 
echo " Please answer the following questions:\n\n"
echo "\tPlease Enter Location # (1-6): \c"
read locat
if [ $locat ] 
then
	if [ $locat -lt 1 ]
	then
		case $locat in
		[QqCcXx])
			echo "\n\tPRINT JOB CANCELLED, press RETURN to EXIT...\c"
			read junk
			exit;;
		*)
			echo "\n\tLocation $locat is invalid, press RETURN to continue...\c"
			read junk;;
		esac 
	else
		if [ $locat -gt 6 ]
		then
			echo "\n\tLocation $locat is invalid, press RETURN to continue...\c"
			read junk
		else
			if [ $locat -lt 10 ]
			then
			case $locat in
			00*)
				echo "\n\tLocation $locat is invalid, press RETURN to continue...\c"
				read junk
				continue;;
			
			1)
				locat="01";;
			2)
				locat="02";;
			3)
				locat="03";;
			4)
				locat="04";;
			5)
				locat="05";;
			6)
				locat="06";;
			esac
			fi
			break
		fi
	fi    
fi
done
 
# The following asks for and verifies the quantity between 1 and 250. If the
# user presses return without a quantity, we simply ask for a quantity again
# until the user presses "q" or puts in a valid quantity.
 
while :
do
clear
echo
echo
echo " Please enter the quantity to print. The quantity allowed is 1 to 250"
echo " forms per batch. This will keep print times to a minimum and will "
echo " not tie up the printer for any great length of time. Figure about 1"
echo " second print time per form. The maximum print time would then be about"
echo " 4 minutes to complete.\n\n"
echo "\tPlease enter the quantity to print (1-250): \c"
read qty
if [ $qty ]
then
	if [ $qty -lt 1 ]
	then
		case $qty in
		[QqXxCc])
			echo "\n\tPRINT JOB CANCELLED, press RETURN to EXIT...\c"
			read junk
			exit;;
		*)
			echo "\n\tYou have entered an invalid quantity, press RETURN to continue...\c"
			read junk;;
		esac
		continue
	else
		if [ $qty -gt 250 ]
		then
			echo "\n\tYou have entered to many, press RETURN to continue...\c"
			read junk
			continue
		else
			break
		fi
	fi
else
	echo "\n\tYou must enter a quantity, press RETURN to continue...\c"
read junk
fi
done
 
while :
do
clear
echo
echo
echo " Now you must select a form type to print.\n" 
echo " Manual Sales Orders are for power failures etc.."
echo " Received on Account forms are for receiving payments at the till.\n\n"
echo "\tForm Type:\n" 
echo "\t    1) Manual Sales Order form\n"
echo "\t    2) Received on Account form\n\n"
echo "\t    Please enter form type: \c"
read type
case $type in
[1])
	type="***SALES MANUALS***"
	formtype="1"
	break;;
[2])
	type="***RECEIVED ON ACCOUNT***"
	formtype="2"
	break;;
[QqXxCc])
	echo "\n\tPRINT JOB CANCELLED, press RETURN to EXIT...\c"
	read junk
	exit;;
*)
	echo
	echo 
	echo "Incorrect selection, press RETURN to continue...\c"
	read junk
	continue;;
esac
done
 
 
case $locat in
 
	01)
		printer="hpofficei"
                ptype="n"
		if [ $formtype -eq "1" ]
		then
			starting=`cat dtsales`
			startfile="dtsales"
		else
			starting=`cat dtroa`
			startfile="dtroa"
		fi
		break;;
	02)
		printer="/dev/ttyd22"
                ptype="s"
		if [ $formtype -eq "1" ]
		then 
			starting=`cat lasales`
			startfile="lasales"
		else
			starting=`cat laroa`
			startfile="laroa"
		fi
		break;;
	03)
		printer="/dev/ttyd16"
                ptype="s"
		if [ $formtype -eq "1" ]
		then
			starting=`cat forestsales`
			startfile="forestsales"
		else
			starting=`cat forestroa`
			startfile="forestroa"
		fi
		break;;
	04)
		printer="/dev/ttyb11"
                ptype="s"
		if [ $formtype -eq "1" ]
		then
			starting=`cat hpsales`
			startfile="hpsales"
		else
			starting=`cat hproa`
			startfile="hproa"
		fi
		break;;
	05)
		printer="/dev/ttyc03"
                ptype="s"
		if [ $formtype -eq "1" ]
		then
			starting=`cat lesales`
			startfile="lesales"
		else
			starting=`cat leroa`
			startfile="leroa"
		fi
		break;;
	06)
		printer="/dev/ttya04"
                ptype="s"
		if [ $formtype -eq "1" ]
		then
			starting=`cat fcsales`
			startfile="fcsales"
		else
			starting=`cat fcroa`
			startfile="fcroa"
		fi
		break;;
esac
 
while :
do
clear
echo
echo " You have selected the following options:\n"
echo "\tLocation:    $locat"
echo "\tQuantity:    $qty"
echo "\tStarting at: $starting"
ending=`expr $starting + $qty - 1`
echo "\tEnding at:   $ending"
echo "\tForm Type:   $type"
echo "\tPrinter:     $printer"
echo 
echo " ***IMPORTANT***"
echo " Make sure no one prints an invoice or order to this printer as the two"
echo " print jobs will collide and both will be ruined and will need to be "
echo " reprinted. It is recommended that you complete this job at a time when"
echo " there is no risk of anyone printing an invoice or order!"
echo 
echo "\tOptions:\n"
echo "\t1) Cancel Print Job"
echo "\t2) Change Printer"
echo "\t3) Accept and Print"
echo "\n\tEnter Choice: \c"
read okay
case $okay in
[1CcQqXx])
	echo "\n\tPRINT JOB CANCELLED, press RETURN to EXIT...\c"
	read junk
	exit;;
2)
	while :
	do
	clear
	echo
	echo
	echo " You must enter the printer device name correctly. "
	echo " The printer you choose must be a printer with the"
	echo " invoice forms loaded and aligned in the usual manner.\n"
	echo " Examples are:\n"
	echo "\tttya03\tttyb16\n"
	echo " Please enter printer device to print to: \c"
	read newprinter
	case $newprinter in
	
	[CcQqXx])
		echo "\n\tPRINT JOB CANCELLED, press RETURN to EXIT...\c"
		read junk
		exit;;
	lp00)
		printer="/dev/$newprinter";ptype="s";break;;
	ttya15)
		printer="/dev/$newprinter";ptype="s";break;;
	ttya23)
		printer="/dev/$newprinter";ptype="s";break;;
	ttya24)
		printer="/dev/$newprinter";ptype="s";break;;
	ttya25)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyb16)
		printer="/dev/$newprinter";ptype="s";break;;
	ttya29)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyd20)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyd16)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyd23)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyd24)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyb08)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyb12)
		printer="/dev/$newprinter";ptype="s";break;;	
	ttyb13)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyb14)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyb15)
		printer="/dev/$newprinter";ptype="s";break;;
	hpofficei)
		printer="$newprinter";ptype="n";break;;
	ttyb11)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyb09)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyc02)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyc03)	
		printer="/dev/$newprinter";ptype="s";break;;
	ttyb01)
		printer="/dev/$newprinter";ptype="s";break;;	
	ttyc15)
		printer="/dev/$newprinter";ptype="s";break;;	
	ttyd28)
		printer="/dev/$newprinter";ptype="s";break;;
	laofficeinv)
		printer="/dev/$newprinter";ptype="s";break;;	
	prc11)
		printer="/dev/$newprinter";ptype="s";break;;
	prc09)
		printer="/dev/$newprinter";ptype="s";break;;
	prc06)
		printer="/dev/$newprinter";ptype="s";break;;
	prc07)
		printer="/dev/$newprinter";ptype="s";break;;
		
	*)
		echo
		echo " Invalid printer device, PRINTER NOT CHANGED!\n"
		echo " Press Return to continue...\c"
		read junk
		break;;
	esac
	done
	continue;;
	
3)
	clear
	echo
	echo
	echo "\n\tSpooling Initiated, Please Wait..."
	total=`expr $starting + $qty`
	echo "\030\022\033\0103\00\07" > form$newfile
	while :
	do
 
	echo "\t\t\t\t\t\t\t  $locat  $starting" >> form$newfile
	if [ $locat -eq "06" ]
	then
		echo "   Forest Commodities\n\n\n\n" >> form$newfile
		type="            Packing Slip"
	else	
	 	echo "\n\n\n" >> form$newfile
	fi
	echo "\033\016$type" >> form$newfile
	starting=`expr $starting + 1`
	if [ $starting -lt $total ]
	then
		echo "\014" >> form$newfile
	fi
	if [ $starting -eq $total ]
	then
		echo -n "\014" >> form$newfile
		echo "\tSending forms to printer..."
            if [ $ptype -eq "s" ]
              then
		cat form$newfile >> $printer
              else
                cat form$newfile | lp -d $printer
            fi
		rm form$newfile
		echo "$starting" > $startfile
		echo "\n\n\n"
		echo "\tForms have been sent."
		echo
		echo "\tYou will now be logged out of this session.\n"
		echo "\tPress RETURN to continue...\c"
		read junk
		exit
	fi
	done
	exit;;
esac
done
 
# DoubleVision Pro's terminal type collector ...
[ -x /bin/termtype ] && /bin/termtype
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:

Select allOpen in new window

 

by: coppsbuildallPosted on 2009-11-04 at 05:20:30ID: 25738978

Hey mikelfritz,

So when running the script I get the following message:

You have selected the following options:

        Location:    02
        Quantity:    5
        Starting at:
expr: syntax error
        Ending at:
        Form Type:   ***SALES MANUALS***
        Printer:     /dev/ttyd22

So if I change the printer to the "hosts" resolved address - "laofficeinv" I get the following:

 You have selected the following options:

        Location:    02
        Quantity:    5
        Starting at:
expr: syntax error
        Ending at:
        Form Type:   ***SALES MANUALS***
        Printer:     laofficeinv

When completing I get the following:

        Spooling Initiated, Please Wait...
expr: syntax error
expr: syntax error
        Sending forms to printer...




        Forms have been sent.

        You will now be logged out of this session.

        Press RETURN to continue...

Nothing prints to the printer ... I have added this specific printer to the list (script attached below).

Thanks for the help!

:
# DoubleVision Pro's digiboard call during login...
[ -x /usr/lib/dv/digi_trigger ] && /usr/lib/dv/digi_trigger
# The following script completes this objective:
 
# Create pre-printed invoices for manual use with either cash or account sales
# Limit invoice # to 6 digits and qty per batch print to 250.
# Also, make it easy to cancel
# Prevent collision of temporary files
 
# v970730
# Co-Written by W. Travis Peters on 97/07/29
# Co-Written by Scott A. Johnston on 97/07/30
PATH=/tools.aix/nullout:/opt/K/SCO/Unix/5.0.6Ga/tcb/bin:/bin:/pm/bin:/bin:/etc:/usr/bin:/tcb/bin
export PATH
 
newfile=`date | cut -c12-13,16-16,18-19`
 
# The following loop asks for a location number and verifies it. If the 
# location number is wrong, it loops and asks for it again. "q" will abort
# the whole script and exit the program
 
while :
do
clear
echo
echo
echo " This program will print 1 to 250 manual forms for Received on Accounts"
echo " and Manual Sales Orders. You may enter \"q\" at any time to quit.\n" 
echo " This program will keep track of your invoice numbers for you.\n" 
echo " Please answer the following questions:\n\n"
echo "\tPlease Enter Location # (1-6): \c"
read locat
if [ $locat ] 
then
	if [ $locat -lt 1 ]
	then
		case $locat in
		[QqCcXx])
			echo "\n\tPRINT JOB CANCELLED, press RETURN to EXIT...\c"
			read junk
			exit;;
		*)
			echo "\n\tLocation $locat is invalid, press RETURN to continue...\c"
			read junk;;
		esac 
	else
		if [ $locat -gt 6 ]
		then
			echo "\n\tLocation $locat is invalid, press RETURN to continue...\c"
			read junk
		else
			if [ $locat -lt 10 ]
			then
			case $locat in
			00*)
				echo "\n\tLocation $locat is invalid, press RETURN to continue...\c"
				read junk
				continue;;
			
			1)
				locat="01";;
			2)
				locat="02";;
			3)
				locat="03";;
			4)
				locat="04";;
			5)
				locat="05";;
			6)
				locat="06";;
			esac
			fi
			break
		fi
	fi    
fi
done
 
# The following asks for and verifies the quantity between 1 and 250. If the
# user presses return without a quantity, we simply ask for a quantity again
# until the user presses "q" or puts in a valid quantity.
 
while :
do
clear
echo
echo
echo " Please enter the quantity to print. The quantity allowed is 1 to 250"
echo " forms per batch. This will keep print times to a minimum and will "
echo " not tie up the printer for any great length of time. Figure about 1"
echo " second print time per form. The maximum print time would then be about"
echo " 4 minutes to complete.\n\n"
echo "\tPlease enter the quantity to print (1-250): \c"
read qty
if [ $qty ]
then
	if [ $qty -lt 1 ]
	then
		case $qty in
		[QqXxCc])
			echo "\n\tPRINT JOB CANCELLED, press RETURN to EXIT...\c"
			read junk
			exit;;
		*)
			echo "\n\tYou have entered an invalid quantity, press RETURN to continue...\c"
			read junk;;
		esac
		continue
	else
		if [ $qty -gt 250 ]
		then
			echo "\n\tYou have entered to many, press RETURN to continue...\c"
			read junk
			continue
		else
			break
		fi
	fi
else
	echo "\n\tYou must enter a quantity, press RETURN to continue...\c"
read junk
fi
done
 
while :
do
clear
echo
echo
echo " Now you must select a form type to print.\n" 
echo " Manual Sales Orders are for power failures etc.."
echo " Received on Account forms are for receiving payments at the till.\n\n"
echo "\tForm Type:\n" 
echo "\t    1) Manual Sales Order form\n"
echo "\t    2) Received on Account form\n\n"
echo "\t    Please enter form type: \c"
read type
case $type in
[1])
	type="***SALES MANUALS***"
	formtype="1"
	break;;
[2])
	type="***RECEIVED ON ACCOUNT***"
	formtype="2"
	break;;
[QqXxCc])
	echo "\n\tPRINT JOB CANCELLED, press RETURN to EXIT...\c"
	read junk
	exit;;
*)
	echo
	echo 
	echo "Incorrect selection, press RETURN to continue...\c"
	read junk
	continue;;
esac
done
 
 
case $locat in
 
	01)
		printer="hpofficei"
                ptype="n"
		if [ $formtype -eq "1" ]
		then
			starting=`cat dtsales`
			startfile="dtsales"
		else
			starting=`cat dtroa`
			startfile="dtroa"
		fi
		break;;
	02)
		printer="/dev/ttyd22"
                ptype="s"
		if [ $formtype -eq "1" ]
		then 
			starting=`cat lasales`
			startfile="lasales"
		else
			starting=`cat laroa`
			startfile="laroa"
		fi
		break;;
	03)
		printer="/dev/ttyd16"
                ptype="s"
		if [ $formtype -eq "1" ]
		then
			starting=`cat forestsales`
			startfile="forestsales"
		else
			starting=`cat forestroa`
			startfile="forestroa"
		fi
		break;;
	04)
		printer="/dev/ttyb11"
                ptype="s"
		if [ $formtype -eq "1" ]
		then
			starting=`cat hpsales`
			startfile="hpsales"
		else
			starting=`cat hproa`
			startfile="hproa"
		fi
		break;;
	05)
		printer="/dev/ttyc03"
                ptype="s"
		if [ $formtype -eq "1" ]
		then
			starting=`cat lesales`
			startfile="lesales"
		else
			starting=`cat leroa`
			startfile="leroa"
		fi
		break;;
	06)
		printer="/dev/ttya04"
                ptype="s"
		if [ $formtype -eq "1" ]
		then
			starting=`cat fcsales`
			startfile="fcsales"
		else
			starting=`cat fcroa`
			startfile="fcroa"
		fi
		break;;
esac
 
while :
do
clear
echo
echo " You have selected the following options:\n"
echo "\tLocation:    $locat"
echo "\tQuantity:    $qty"
echo "\tStarting at: $starting"
ending=`expr $starting + $qty - 1`
echo "\tEnding at:   $ending"
echo "\tForm Type:   $type"
echo "\tPrinter:     $printer"
echo 
echo " ***IMPORTANT***"
echo " Make sure no one prints an invoice or order to this printer as the two"
echo " print jobs will collide and both will be ruined and will need to be "
echo " reprinted. It is recommended that you complete this job at a time when"
echo " there is no risk of anyone printing an invoice or order!"
echo 
echo "\tOptions:\n"
echo "\t1) Cancel Print Job"
echo "\t2) Change Printer"
echo "\t3) Accept and Print"
echo "\n\tEnter Choice: \c"
read okay
case $okay in
[1CcQqXx])
	echo "\n\tPRINT JOB CANCELLED, press RETURN to EXIT...\c"
	read junk
	exit;;
2)
	while :
	do
	clear
	echo
	echo
	echo " You must enter the printer device name correctly. "
	echo " The printer you choose must be a printer with the"
	echo " invoice forms loaded and aligned in the usual manner.\n"
	echo " Examples are:\n"
	echo "\tttya03\tttyb16\n"
	echo " Please enter printer device to print to: \c"
	read newprinter
	case $newprinter in
	
	[CcQqXx])
		echo "\n\tPRINT JOB CANCELLED, press RETURN to EXIT...\c"
		read junk
		exit;;
	lp00)
		printer="/dev/$newprinter";ptype="s";break;;
	ttya15)
		printer="/dev/$newprinter";ptype="s";break;;
	ttya23)
		printer="/dev/$newprinter";ptype="s";break;;
	ttya24)
		printer="/dev/$newprinter";ptype="s";break;;
	ttya25)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyb16)
		printer="/dev/$newprinter";ptype="s";break;;
	ttya29)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyd20)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyd16)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyd23)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyd24)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyb08)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyb12)
		printer="/dev/$newprinter";ptype="s";break;;	
	ttyb13)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyb14)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyb15)
		printer="/dev/$newprinter";ptype="s";break;;
	hpofficeinv)
		printer="$newprinter";ptype="n";break;;
	laofficeinv)
		printer="$newprinter";ptype="n";break;;
	ttyb11)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyb09)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyc02)
		printer="/dev/$newprinter";ptype="s";break;;
	ttyc03)	
		printer="/dev/$newprinter";ptype="s";break;;
	ttyb01)
		printer="/dev/$newprinter";ptype="s";break;;	
	ttyc15)
		printer="/dev/$newprinter";ptype="s";break;;	
	ttyd28)
		printer="/dev/$newprinter";ptype="s";break;;
	prc11)
		printer="/dev/$newprinter";ptype="s";break;;
	prc09)
		printer="/dev/$newprinter";ptype="s";break;;
	prc06)
		printer="/dev/$newprinter";ptype="s";break;;
	prc07)
		printer="/dev/$newprinter";ptype="s";break;;
		
	*)
		echo
		echo " Invalid printer device, PRINTER NOT CHANGED!\n"
		echo " Press Return to continue...\c"
		read junk
		break;;
	esac
	done
	continue;;
	
3)
	clear
	echo
	echo
	echo "\n\tSpooling Initiated, Please Wait..."
	total=`expr $starting + $qty`
	echo "\030\022\033\0103\00\07" > form$newfile
	while :
	do
 
	echo "\t\t\t\t\t\t\t  $locat  $starting" >> form$newfile
	if [ $locat -eq "06" ]
	then
		echo "   Forest Commodities\n\n\n\n" >> form$newfile
		type="            Packing Slip"
	else	
	 	echo "\n\n\n" >> form$newfile
	fi
	echo "\033\016$type" >> form$newfile
	starting=`expr $starting + 1`
	if [ $starting -lt $total ]
	then
		echo "\014" >> form$newfile
	fi
	if [ $starting -eq $total ]
	then
		echo -n "\014" >> form$newfile
		echo "\tSending forms to printer..."
            if [ $ptype -eq "s" ]
              then
		cat form$newfile >> $printer
              else
                cat form$newfile | lp -d $printer
            fi
		rm form$newfile
		echo "$starting" > $startfile
		echo "\n\n\n"
		echo "\tForms have been sent."
		echo
		echo "\tYou will now be logged out of this session.\n"
		echo "\tPress RETURN to continue...\c"
		read junk
		exit
	fi
	done
	exit;;
esac
done
 
# DoubleVision Pro's terminal type collector ...
[ -x /bin/termtype ] && /bin/termtype

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:

Select allOpen in new window

 

by: coppsbuildallPosted on 2009-11-04 at 05:40:38ID: 25739145

ok ... so i didnt copy over the files that contained the invoice numbers ... error messages are no longer present ... :)

still no printing ... however it did create a new file in the directory (attached below).

 

by: mikelfritzPosted on 2009-11-04 at 06:09:28ID: 25739403

expr: syntax error   - this will happen if one of the variables is not properly initiated.  I looks like "starting" is not getting a value.  Look at line 170, I assume you must run this script from within the same directory as the "dtroa" file or the cat will fail, although I would think cat would yelp about not finding the file...

What does the dtroa file contain?  If it's non-numeric (which it is based on the above post - "starting at:" is blank) then:

ending=`expr $starting + $qty - 1`

will give a syntax error since $starting is not a number.



 

by: mikelfritzPosted on 2009-11-04 at 06:11:33ID: 25739411

Is there a spool named laofficeinv?

lpstat -v

 

by: coppsbuildallPosted on 2009-11-04 at 06:11:49ID: 25739414

No error message now ... you are correct about the file not being in the same directory. Now it runs properly ... just no print out ... and that file that I posted above gets created in the directory.

 

by: coppsbuildallPosted on 2009-11-04 at 06:12:24ID: 25739417

# lpstat -v
#

 

by: mikelfritzPosted on 2009-11-04 at 06:12:47ID: 25739423

And can you manually print to it:

cat /etc/hosts | lp -d laofficeinv

 

by: coppsbuildallPosted on 2009-11-04 at 06:14:33ID: 25739440

# cat /etc/hosts | lp -d laofficeinv
UX:lp: ERROR: Destination "laofficeinv" is unknown to the
              LP print service.

Sorry ... maybe I didn't explain this properly. This "Print Server" is new on the network. We have not setup anything in Unix to allow for printing. I thought thought that it would just be able to send jobs to it based on the IP resolving in the hosts file.

 

by: mikelfritzPosted on 2009-11-04 at 06:22:17ID: 25739499

scoadmin -> printers -> HP Network Printer Manager -> 6
spool = laofficeinv
host = laofficeinv

add the printer and use HPLaserJet as the model.  You will most likely need to modify the print script to send the data as raw.  The script is:

/usr/spool/lp/admins/lp/interfaces/model.orig/laofficeinv

You will want to change these lines:
outputmode="cooked"
banner="yes"

To:
outputmode="raw"
banner=""

 

by: coppsbuildallPosted on 2009-11-04 at 06:33:30ID: 25739625

# cat /etc/hosts | lp -d laofficeinv
request id is laofficeinv-2 (standard input)

# lpstat -v
device for laofficeinv: /dev/null

 

by: mikelfritzPosted on 2009-11-04 at 06:36:03ID: 25739652

Okay - did the printer actually print something (it may staircase the print, but that's okay)?

 

by: coppsbuildallPosted on 2009-11-04 at 06:39:05ID: 25739684

Unfortunately nothing has printed ... i even tried to run the script again as well.

 

by: mikelfritzPosted on 2009-11-04 at 06:57:44ID: 25739921

lpstat -t

To see if the job even went.  

telnet laofficeinv 9100

To see if you can connect to the printer from the server.

If the above looks okay,
You may need to run:
scoadmin -> printers -> HP Network Print Services Manager->i

to configure the hp services.  This process should only be run once, if it is run again it will break the hp services I think, I could be wrong about that though.

 

by: coppsbuildallPosted on 2009-11-04 at 12:02:20ID: 25743311

# lpstat -t
scheduler is running
no system default destination
device for laofficeinv: /dev/null
laofficeinv accepting requests since Wed Nov 04 09:28:09 EST 2009
printer laofficeinv now printing laofficeinv-2. enabled since Wed Nov 04 09:28:0
9 EST 2009. available.
laofficeinv-2           root              2111   Nov 04 09:29 on laofficeinv
#

# telnet laofficeinv 9100
Trying 192.168.4.206...
Connected to laofficeinv.
Escape character is '^]'.

sent print job ...
no go

# lpstat -t
scheduler is running
no system default destination
device for laofficeinv: /dev/null
laofficeinv accepting requests since Wed Nov 04 09:28:09 EST 2009
printer laofficeinv now printing laofficeinv-2. enabled since Wed Nov 04 09:28:0
9 EST 2009. available.
laofficeinv-2           root              2111   Nov 04 09:29 on laofficeinv

 

by: coppsbuildallPosted on 2009-11-04 at 12:03:20ID: 25743321

scoadmin -> printers -> HP Network Print Services Manager->i

i ran this as well ... before i sent the job ...

 

by: mikelfritzPosted on 2009-11-04 at 13:14:42ID: 25744011

Have you tried to power cycle the printer?  The job is stuck - although it's job number 2 - where did job 1 go?  You can:

cancel laofficeinv

to get rid of that job.  Then power cycle the printer.  Then send a job as root (do it while logged in as root), maybe send the file that the script creates:

cat formXXXXXX | lp -d laofficeinv

Then:
lpstat -t

see if the job is listed (if it is, it has not printed yet).  If it prints then there may be a permissions issue where only superuser can print...

SCO and printing has always been a pain...
If the job spools from the script then at least that part is solved - then you just need to get the system and printer to behave.

 

by: coppsbuildallPosted on 2009-11-04 at 13:27:09ID: 25744127

ok ... ran the cancel ... removed the job.

tried to print using cat laofficeinv| lp -d laofficeinv

no go ...

# lpstat -t
scheduler is running
no system default destination
device for laofficeinv: /dev/null
laofficeinv accepting requests since Wed Nov 04 09:28:09 EST 2009
printer laofficeinv now printing laofficeinv-3. enabled since Wed Nov 04 09:28:0
9 EST 2009. available.
laofficeinv-3           root               456   Nov 04 16:22 on laofficeinv
#

 

by: coppsbuildallPosted on 2009-11-04 at 13:57:13ID: 25744418

I also power cycled the printer / and print server to make sure.

 

by: mikelfritzPosted on 2009-11-04 at 14:04:22ID: 25744477

Well, it's semi-no-go.  The job is spooling.  What kind of printer and model of print server are these?

Will it print a test page from the print server?

Maybe set the printer up on a windows machine and see if you can make it print...

 

by: mikelfritzPosted on 2009-11-04 at 14:06:47ID: 25744511

Also, if you run the print from the script does lpstat -t show a new job (just to get back to the original issue)?

I just want to know if the issue is now strictly confined to printing in general or if we need to revisit the script.

 

by: coppsbuildallPosted on 2009-11-04 at 14:24:35ID: 25744700

It does show in the spooler ... Printer is oki ml320t with a startech pm1115p attached to it.

 

by: mikelfritzPosted on 2009-11-04 at 14:41:09ID: 25744860

Try a windows machine as a test - add a local port, standard network on port 9100 and generic text driver.  See if it prints.  I'm not familiar with the startech print server but upon further inspection it may not actually accept print jobs on port 9100.  The solution could be to set it up with LPR instead of the HP JD stuff.  We'll see after you test with a Windows machine...

The good news is that the script seems to be working as intended...

On a side note;  I have used some of the secondary brand print servers and have been disappointed with them,  you can get external jetdiret 300's or 170's on e-bay on the cheap and they are much more reliable in my opinion.

 

by: coppsbuildallPosted on 2009-11-04 at 16:38:59ID: 25745760

Currently these are the only ones that are being supported by our POS provider ... I will try and setup a print job to the port itself, will advise tomorrow afternoon.

 

by: coppsbuildallPosted on 2009-11-04 at 16:39:11ID: 25745762

Thanks for your help BTW. :)

 

by: mikelfritzPosted on 2009-11-04 at 17:34:50ID: 25746012

Welcome - I'd bet the printserver won't accept jobs on 9100, maybe some other port (if so then it can be done) or LPR jobs on 515 with a queue name.  HP may not take kindly to the competition masquerading as them...

If this is the only pserver you can use then LPR may be the best way to go.  You would first use the above HP nonsense and choose 8 to remove the queue, then go to:
SCOADMIN -> PRINTERS -> PRINTER MANAGER
printer menu, add remote, unix, laofficeinv for printer and host, deselect extended.

 

by: coppsbuildallPosted on 2009-11-04 at 18:08:48ID: 25746174

Ok ... printer removed:

HP Network Print Services Manager
HP Network Printer Manager

I am trying to add the printer ... however after going into printers > printer manager  > print > add remote > then i am not able to click on anything. I tried enter, arrows, everything I could think of. The only thing I can do is press ESC to go back to the previous selection.

?

 

by: mikelfritzPosted on 2009-11-04 at 18:14:20ID: 25746194

You can't type anything once in there?  I'm doing it character based so there's no clicking on anything.  The tab key is essential, it's a horrid interface.

 

by: mikelfritzPosted on 2009-11-04 at 18:17:55ID: 25746210

Possibly (not advisable) from a root prompt - "mkdev rlp" and install...

I think this is the one that will break if done more than once.

 

by: coppsbuildallPosted on 2009-11-04 at 18:19:23ID: 25746216

actually i can click on the "add local" ... really click on it. I have also tried to use the keyboard ... no go. I can get into the Add Local but not the Add Remote. Is there something that I need to enable first to access this?

 

by: coppsbuildallPosted on 2009-11-04 at 18:21:46ID: 25746227

Is this not something that is done during the OS install? I think that if this could cause issues that I will contact our POS first before I run this.

 

by: mikelfritzPosted on 2009-11-04 at 18:30:30ID: 25746262

Not really.  Any issues it creates are fixable, just more stuff to mess with.  Maybe try under print manager -> system -> print services -> enable remote and local.

 

by: coppsbuildallPosted on 2009-11-04 at 18:42:29ID: 25746310

would it create any issues with our existing serial printers that connect through port servers? just checking before i do anything.

 

by: coppsbuildallPosted on 2009-11-04 at 18:44:42ID: 25746320

wont let me put a * on the remote.

 

by: mikelfritzPosted on 2009-11-04 at 18:45:07ID: 25746322

No issues with that - the serial printers are accessed via device nodes with no spooler involved.

 

by: coppsbuildallPosted on 2009-11-04 at 18:53:47ID: 25746357

Ok ... I will check back in with you tomorrow when I am back onsite!

 

by: coppsbuildallPosted on 2009-11-10 at 11:20:08ID: 25788731

sorry ... been really bogged down lately ... will advise later this week.

 

by: coppsbuildallPosted on 2009-11-13 at 05:31:36ID: 31648171

Thanks for all the help mikelfritz. Unfortunately I can't move any forward with right now until I can get our POS people in here. If I break something it would be distastrious for the company.

Thanks again and once I can proceed with this I will repost looking for your support again! :)

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...