LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   lp printing with bash script: how to sure the file has been printed? (https://www.linuxquestions.org/questions/programming-9/lp-printing-with-bash-script-how-to-sure-the-file-has-been-printed-4175495953/)

masavini 02-23-2014 11:59 AM

lp printing with bash script: how to sure the file has been printed?
 
hi,
i have several scripts that send files to a printer:
Code:

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
Code:

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

any suggestion?

thanks

michaelk 02-23-2014 12:13 PM

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


All times are GMT -5. The time now is 08:28 PM.