I have a remote Mac that is connected to the printer.
I trigger the print on my Mac remotely using ssh from my local system using "ssh port forwarding/tunneling" discussed here.
Below is my code on the local system that triggers the printer lp
command on the remote server and checks if it was successfully printed.
until ssh -p 3334 remuser@localhost "lp -d Brother_HL_L2350DW_series $HOMEDIR/Printed/$NEWFILE" >/home/system/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/send4print/printererror.log`"
ls -ltr $FILE >>/home/system/send4print/printererror.log
mail -s "PRINTER SERVICE FAIL ALERT. PLEASE CHECK YOUR PRINTER!!" [email protected] < /home/system/send4print/mailbody.txt
sleep 20
done
echo "Print successful. Deleting $FILE"
I got the below message printed in the logs indicating that the print was successful.
nohup.out:Print successful. Deleting /home/system/send4print/online_delivery_10000656.pdf
However, upon checking the remote Mac OS system printing had failed due to the below error.
online_delivery_10000656.pdf
Stopped - Can't open "/private/var/spool/cups/d12637-001"
The snapshot of the same is attached herewith.
I need help with a couple of stuff here:
In case of such failures like
Can't open "/private/var/spool/cups/d12637-001"
or others on the remote host; I want the return code on in my local script as non-successful while currently, I get0
Remedy for this error
Can't open "/private/var/spool/cups/d12637-001"
so that I can retry the print and make sure it gets printed the second time.