SSH를 사용하여 원격 시스템에서 실패한 인쇄를 감지할 수 없습니다.

SSH를 사용하여 원격 시스템에서 실패한 인쇄를 감지할 수 없습니다.

다음은 원격 MACOS 시스템에서 PDF를 인쇄하기 위해 Linux에 있는 코드입니다.

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

아래는 특정 인쇄물에 대한 로그입니다 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

로그에는 인쇄가 성공했으며 반환 코드는 0(성공)이라고 표시됩니다.

그러나 인쇄는 실제로 실패합니다. 아래는 동일한 스냅샷입니다.

실수:Gestoppt - Can't open "/private/var/spool/cups/d02183-001.

여기에 이미지 설명을 입력하세요.

인쇄가 실제로 성공하도록 코드를 개선하려면 어떻게 해야 합니까?

다음은 lpstat -t로그입니다.

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 

답변1

주석에서 언급했듯이 종료 상태는 lp단순히 작업이 성공적으로 대기열에 추가되었음을 나타냅니다. 설명서에 따르면 종료 상태 > 0은 "사용 가능한 출력 장치가 없거나 오류가 발생했습니다"를 의미합니다. ("오류가 발생했습니다"라는 말은 좀 낯설네요.)

ssh -p 3335 ibrahimince@localhost lpstat -t빠른 해결책은 출력을 사용하고 구문 분석하는 것입니다 .

관련 정보