Freebsd

如何協調 lpstat -s 輸出與 lpr 呼叫

  • June 15, 2021

我有一個關於lpstatFreeBSD-12.2 的問題。具體來說,我看不到他的輸出lpstat與實際需要的列印機名稱之間的關係lpr

例如。我跑了lpstat -t,看到了這個:

lpstat -t
scheduler is running
system default destination: NP4172.HAMILTON.HARTE-LYNE.CA
device for CUPS_PCL3_to_File_jbb: /var/spool/cups-pdf/pcl3/cups_to_pcl3.prn
device for laserIII_PCL: /var/spool/cups-pdf/byrnejb_hll/laseriii.pcl
device for NP4172.HAMILTON.HARTE-LYNE.CA: socket://192.168.216.52
device for NP4173.HAMILTON.HARTE-LYNE.CA: socket://192.168.216.53
device for NP4174.HAMILTON.HARTE-LYNE.CA: socket://192.168.216.54
device for Virtual_PDF_Printer: cups-pdf:/
CUPS_PCL3_to_File_jbb accepting requests since Wed May  5 11:21:40 2021
laserIII_PCL accepting requests since Fri May 21 16:13:32 2021
NP4172.HAMILTON.HARTE-LYNE.CA accepting requests since Mon Jun 14 14:15:06 2021
NP4173.HAMILTON.HARTE-LYNE.CA accepting requests since Mon Jun 14 16:12:44 2021
NP4174.HAMILTON.HARTE-LYNE.CA accepting requests since Fri Jun 11 16:16:28 2021
Virtual_PDF_Printer accepting requests since Mon Apr 12 12:42:45 2021
printer CUPS_PCL3_to_File_jbb is idle.  enabled since Wed May  5 11:21:40 2021
printer laserIII_PCL is idle.  enabled since Fri May 21 16:13:32 2021
printer NP4172.HAMILTON.HARTE-LYNE.CA is idle.  enabled since Mon Jun 14 14:15:06 2021
printer NP4173.HAMILTON.HARTE-LYNE.CA is idle.  enabled since Mon Jun 14 16:12:44 2021
printer NP4174.HAMILTON.HARTE-LYNE.CA is idle.  enabled since Fri Jun 11 16:16:28 2021
printer Virtual_PDF_Printer is idle.  enabled since Mon Apr 12 12:42:45 2021
NP4172.HAMILTON.HARTE-LYNE.CA-528 root                 0   Tue Jun 15 09:09:28 2021

但是列印機NP4172.HAMILTON.HARTE-LYNE.CA實際上並沒有被以下人員辨識lpr

lpr -P NP4172.HAMILTON.HARTE-LYNE.CA info.txt
lpr: NP4172.HAMILTON.HARTE-LYNE.CA: unknown printer

如果我這樣做:lpr -P np4172 info.txt然後文件被假離線並列印。但是,如果我這樣做,我會收到未知的列印機錯誤:

lpr -P NP4172 info.txt
lpr: NP4172: unknown printer

該主機系統使用CUPS. 我已經/etc/printcap配置了文件,lpd並且 的CUPS版本lpd正在執行(如 的輸出所示lpstat -t)。列印機名稱np4172/etc/printcap其中,這無疑是在哪裡lpr檢查。但是,使用預期的工具顯然不容易找到這些基本資訊。

這讓我很困惑。如果我想找到主機上可用的實際列印機名稱,那麼顯示lpr將接受的真實列印機名稱的命令是什麼?

如果我想查找主機上可用的實際列印機名稱,那麼顯示 lpr 將接受的真實列印機名稱的命令是什麼?

lpc status all可能是您正在尋找的:

$ lpc status all
lpraw:
       queuing is enabled
       printing is enabled
       no entries in spool area
       printer idle
lp:
       queuing is enabled
       printing is enabled
       no entries in spool area
       printer idle
lj2430:
       queuing is enabled
       printing is enabled
       no entries in spool area
       printer idle
clr:
       queuing is enabled
       printing is enabled
       no entries in spool area
       printer idle

引用自:https://unix.stackexchange.com/questions/654364