Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 02-23-2014, 11:59 AM   #1
Registered: Jun 2008
Posts: 232

Rep: Reputation: 6
lp printing with bash script: how to sure the file has been printed?

i have several scripts that send files to a printer:
lp -d ML-1640 "$_docN.$_c.pdf"
sometimes (very rare, but it happens) something goes wrong, and the gnome print status wiewer reports an error. if i'm in the office, i just click ok, pick the right file and print it again "manually".
if i'm NOT in the office, here comes panic. they call me on the phone, if i can't answer the activity gets stucked...

sure, i tried and explain them how to open the right file with nautilus and print it with evince, but no way to get it done.

do you know if there a way to let the script guess if the print process went fine? since it occurs rarely i can't make any test...

i'd like to simply put a control like
while (( $? > 0 )); do lp -d ML-1640 "$_docN.$_c.pdf"; done
but i'm pretty sure it won't work...

any suggestion?


Last edited by masavini; 02-23-2014 at 04:50 PM.
Old 02-23-2014, 12:13 PM   #2
Registered: Aug 2002
Posts: 14,662

Rep: Reputation: 1459Reputation: 1459Reputation: 1459Reputation: 1459Reputation: 1459Reputation: 1459Reputation: 1459Reputation: 1459Reputation: 1459Reputation: 1459
cups has several command line utilities that can be used to check/view status of a printer queue. Check out lpstat and lpq.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
BASH: Modify script to take $1 that specifies the number of chapters to be printed Mes9 Programming 9 09-26-2012 02:36 PM
bash script to apply a command to a file to be printed linuxandtsm Linux - Newbie 7 09-28-2011 01:02 PM
LXer: Creating 3D Printed Models with Blender and the Shapeways Printing Service LXer Syndicated Linux News 0 05-27-2011 12:51 PM
Bash:Printing the line number in bash script suryaemlinux Programming 2 02-05-2011 09:59 AM
Chinse character printed garbled when printing through lp command amit_pansuria Linux - General 1 07-29-2009 09:48 PM

All times are GMT -5. The time now is 02:42 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration