Below is my code on linux that prints a PDF on a remote MACOS system.
echo "Printing ssh -p 3335 ibrahimince@localhost 'lp -d Brother_HL_L2350DW_series $HOMEDIR/Printed/$NEWFILE'"; echo "Remote File details are:" ssh -p 3335 ibrahimince@localhost "ls -ltr $HOMEDIR/Printed/$NEWFILE" until ssh -p 3335 ibrahimince@localhost "lp -o media=A5 -d Brother_HL_L2350DW_series $HOMEDIR/Printed/$NEWFILE" >/home/system/efendibey.de/invoices/send4print/printererror.log 2>&1 do echo "Exit Code of the command was: $?" echo "Send email that there is an issue printing invoice for the below file. Issue is: `cat /home/system/efendibey.de/invoices/send4print/printererror.log`" ls -ltr $FILE >>/home/system/efendibey.de/invoices/send4print/printererror.log mail -s "PRINTER SERVICE FAIL ALERT. PLEASE CHECK YOUR PRINTER!!" [email protected] < /home/system/efendibey.de/invoices/send4print/mailbody.txt sleep 20 done echo "Print successful. Deleting $FILE" rm $FILE; fi
Here are the logs for a particular print online_delivery_10001333.pdf
.
Printing ssh -p 3335 ibrahimince@localhost 'lp -d Brother_HL_L2350DW_series /Users/ibrahimince/Printed/online_delivery_10001333.pdf' Remote File details are: -rw-r--r-- 1 ibrahimince staff 11496 Aug 2 19:29 /Users/ibrahimince/Printed/online_delivery_10001333.pdf Print successful. Deleting /home/system/efendibey.de/invoices/send4print/online_delivery_10001333.pdf
The logs say that the print was successful and the return code was 0(successful).
But, the print actually failed, and below is the snapshot of the same.
Error: Gestoppt - Can't open "/private/var/spool/cups/d02183-001.
How can I refine my code so to make sure the print was actually successful?
Below is the lpstat -t
logs:
Remote File details are: -rw-r--r-- 1 ibrahimince staff 11507 Aug 18 20:00 /Users/ibrahimince/Printed/online_delivery_10001333.pdf scheduler is running system default destination: Brother_HL_L2350DW_series device for Brother_HL_L2350DW_series: dnssd://Brother%20HL-L2350DW%20series._ipp._tcp.local./?uuid=e3248000-80ce-11db-8000-2c6fc95df52e device for Brother_MFC_L3750CDW_series_b_3_Fax: dnssd://Brother%20MFC-L3750CDW%20series._ipp._tcp.local./?uuid=e3248000-80ce-11db-8000-3c2af4dd8a75 device for Canon_TS700_series: ippusb://Canon%20TS700%20series._ipp._tcp.local./?uuid=00000000-0000-1000-8000-00186d1376d5 device for Kyocera_ECOSYS_M5526cdw: dnssd://Kyocera%20ECOSYS%20M5526cdw._ipps._tcp.local./?uuid=4509a320-00a6-0073-00bb-002507512ad9 device for Kyocera_ECOSYS_M5526cdw_b_3_Fax: dnssd://Kyocera%20ECOSYS%20M5526cdw._ipps._tcp.local./?uuid=4509a320-00a6-0073-00bb-002507512ad9 Brother_HL_L2350DW_series accepting requests since Wed Aug 18 20:00:24 2021 Brother_MFC_L3750CDW_series_b_3_Fax accepting requests since Tue Jun 29 17:04:09 2021 Canon_TS700_series accepting requests since Wed Aug 18 18:34:42 2021 Kyocera_ECOSYS_M5526cdw accepting requests since Thu Jul 8 12:30:45 2021 Kyocera_ECOSYS_M5526cdw_b_3_Fax accepting requests since Thu Jul 8 12:28:58 2021 printer Brother_HL_L2350DW_series is idle. enabled since Wed Aug 18 20:00:24 2021 Can't open "/private/var/spool/cups/d03050-001." printer Brother_MFC_L3750CDW_series_b_3_Fax is idle. enabled since Tue Jun 29 17:04:09 2021 printer Canon_TS700_series is idle. enabled since Wed Aug 18 18:34:42 2021 printer Kyocera_ECOSYS_M5526cdw disabled since Thu Jul 8 12:30:45 2021 - reason unknown printer Kyocera_ECOSYS_M5526cdw_b_3_Fax is idle. enabled since Thu Jul 8 12:28:58 2021 Brother_HL_L2350DW_series-3050 ibrahimince 12288 Wed Aug 18 20:00:24 2021 Print successful. Deleting