作者 主題: CUPS (1)access your printer by browser  (閱讀 5357 次)

0 會員 與 1 訪客 正在閱讀本文。

小徒兒

  • 區域板主
  • 鑽研的研究生
  • *****
  • 文章數: 621
    • 檢視個人資料
CUPS (1)access your printer by browser
« 於: 2004-08-31 06:29 »
Before you go:


user $lpr test.txt (fontend interface deal with user) commands(lpr), ipp(http://),C interface(kprint)
   |
   |
  print daemon 
 |     | 
 3     2
raw data
 |     |
printfilter spool
 |
printable format
 |
 4
 |
print backend (backend drivers deal with printer) localport (usb,serial,parallel),Network (IPP,SMB,URI)



#cd /etc
#cp -a cups cups.bak
#service cups start
#chkconfig cups on
http://localhost:631 新增一個印表機
#vi printer.conf


8)  8)  8)  Source from Netman 8)  8)  8)  8)  8) 8)  8)  8) 8)  8)  8)

1) URI 寫法:
http://cups.server.address:631/printers/pinter_name
example:
代碼: [選擇]
<Printer laser2>
DeviceURI http://192.168.100.90:631/printers/laser2
State Idle
Accepting Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
</Printer>


2) 開放 admin browsing:
修改 /etc/cups/cupsd.conf,
跑到文件最後面, 增加 BrowseAllow from address 及 Listen address:port,
example:
代碼: [選擇]
Browsing On
BrowseProtocols cups
BrowseOrder Deny,Allow
BrowseAllow from @LOCAL
BrowseAllow from 192.168.100.0/24
Listen 127.0.0.1:631
Listen 192.168.100.2:631


3) 開放 location
修改 /etc/cups/cupsd.conf 裡的 <Location /admin> 及 <Location />,
增加 Allow From addrss
example:
代碼: [選擇]
<Location /admin>
#
# You definitely will want to limit access to the administration functions.
# The default configuration requires a local connection from a user who
# is a member of the system group to do any admin tasks.  You can change
# the group name using the SystemGroup directive.
#

AuthType Basic
AuthClass System

## Restrict access to local domain
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
Allow From 192.168.100.0/24

#Encryption Required
</Location>
....
</Location>
<Location />
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
Allow From 192.168.100.0/24
</Location>




- after the configuration
#service cups restart
#netstat -aup|grep 631

小徒兒

  • 區域板主
  • 鑽研的研究生
  • *****
  • 文章數: 621
    • 檢視個人資料
(2)basic command
« 回覆 #1 於: 2004-08-31 06:42 »
lpadmin –p “HP 710C” –c MyPrinterClass
lpadmin –p “Epson 60” –c MyPrinterClass
lpr -P MyPrinterClass /file/to/print # = lp -d MyPrinterClass /file/to/print


lpadmin -v URI
URI:
file://dev/lp0
http://61.64.186.51:631/printers/MyPrinterClass #MyPrinterClass is a printer name
smb://hostname/sharename


Configure by webbase browser
http://61.64.186.51:631/admin

kprinter #by gui



$ lpq #Examine active jobs:


$ lpq -Plp #Examine queue lp, which turns out to be empty:
no entries

$ lpq -l #Examine those same jobs using the long format:
lp is ready and printing
root: active                             [job 193AsJRzIt]
        filter                           9443 bytes
root: 1st                                [job 194AMj9lo9]
        resume.txt                       11024 bytes
root: 2nd                                [job 196A6rUGu5]
        (standard input)                 18998 bytes


$ lpq bsmith #Examine jobs owned by bsmith:
Rank   Owner      Job  Files                 Total Size
7th    bsmith     202  .bash_history         1263 bytes
9th    bsmith     204  .bash_profile         5676 bytes

$ lprm - #As a normal user, remove all of your print jobs:


# lprm -Pps - #As the superuser, remove all jobs from queue ps:


# lpc
lpc> help
Commands may be abbreviated.  Commands are:

abort   enable  disable help    restart status  topq    ?
clean   exit    down    quit    start   stop    up
lpc>



# lpc status
lp:
   queuing is enabled
   printing is enabled
   2 entries in spool area
   lp is ready and printing

Example 2

Suppose user jdean has submitted two important print jobs, 206 and 207, and that he needs job 207 to be moved to the top of the queue, followed immediately by 206 (see the emphasized lines in the lpq output). First, examine the existing jobs:

# lpq
Rank   Owner      Job  Files                 Total Size
active root       203  filter                9443 bytes
1st    root       204  status                25 bytes
2nd    root       205  (standard input)      6827 bytes
3rd    jdean      206  (standard input)      403 bytes
4th    jdean      207  cert1.txt             4865 bytes

Now modify the position of print jobs 206 and 207:

# lpc topq lp 207 206
lp:
   moved cfA206AlIwYoh
   moved cfA207Ad6utse

Finally, verify the results:

# lpq
Rank   Owner      Job  Files                 Total Size
1st    jdean      207  cert1.txt             4865 bytes
2nd    jdean      206  (standard input)      403 bytes
3rd    root       203  filter                9443 bytes
4th    root       204  status                25 bytes
5th    root       205  (standard input)      6827 bytes

With this reconfiguration, printing continues with jobs 207 and 206 first, and then reverts to jobs 203 through 205.
Example 3

Disable and enable print queue lp, to allow current printing to complete while rejecting new jobs:

# lpc disable lp
lp:
   queuing disabled
# lpc enable lp
lp:
   queuing enabled

Example 4

Stop and restart printing on the printer attached to queue lp, but allow new jobs to be queued for future printing:

# lpc stop lp
lp:
   printing disabled
# lpc start lp
lp:
   printing enabled
   daemon started  

If no jobs are pending, a child lpd will not start immediately in response to start, though the daemon started message is still displayed. Note also that when a child lpd process is stopped, its subprocesses (such as filters) are also stopped.
Example 5

Abandon all printing activity on the print queue lp. Note that a printer with data in its print buffer may continue to print even after an abort:

# lpc abort lp
lp:
printing disabled
daemon (pid 2012) killed


資料來源
lpi in a nutshell
ibm linux system administartion I student notebook