À¯´Ð½º ±â°è¿¡¼ PCÂÊ¿¡ ¿¬°áµÈ ÇÁ¸°Å͸¦ °øÀ¯ÇÏ°í ½ÍÀ» °æ¿ì°¡ ÀÖÀ» °ÍÀÌ´Ù. ÇÁ¸°ÅÍ °øÀ¯±â¸¦ ±¸¸ÅÇØ¼ ¿¬°áÇÏ´Â ¹æ¹ýÀÌ °¡Àå ½±Áö¸¸, ºÎ°¡ ºñ¿ëÀÌ µé°Ô µÈ´Ù. ´ÙÀ½ÀÇ ¹æ¹ýÀ» »ý°¢Çغ¸ÀÚ.
% smbclient '\\dark\lp' -P -N (P ¼±Åà »ç¾çÀº ÇÁ¸°Å͸¦ ÀǹÌ, N ¼±Åà »ç¾çÀº ÆÐ½º¿öµå ÀÔ·ÂÀ» °Ç³Ê¶Ù´Â °ÍÀ» ÀǹÌ)
smb: \> lcd /usr/local/lib/ghostscript/examples
smb: \> put tiger.ps
ŸÀÌÇÎÀ» ½È¾îÇϽô ºÐÀ» À§ÇØ ºñ·Ï Ç¥ÁØ »ï¹Ù ÆÐŰÁö¿¡´Â Æ÷ÇԵǾî ÀÖÁö ¾ÊÁö¸¸ printcap°ú ¿¬µ¿ÇÏ¿© »ç¿ëÇÒ ¼ö ÀÖµµ·Ï ÇÏ´Â ÀÔ·Â Åë½Å ÇÊÅÍÀÎ smbprint¸¦ ¼Ò°³ÇÑ´Ù. BSD °è¿ÀÇ ÇÁ¸°ÆÃ ±â´É (lpr, lpc)À» °¡Áø È£½ºÆ®°¡ ÀÖ´Ù¸é °è¼ÓÇØ¼ À̾îÁú ÀÏ·ÃÀÇ ¼³Ä¡ ¹æ¹ýÀ» »ìÆìº¸ÀÚ.
--------------------- smbprint -------------------------------------------- #!/bin/sh -x # This script is an input filter for printcap printing on a unix machine. # It uses the smbclient program to print the file to the specified # smb-based server and service. # For example you could have a printcap entry like this # # smb:lp=/dev/null:sd=/usr/spool/smb:sh:if=/usr/local/samba/smbprint # # which would create a unix printer called "smb" that will print via this # script. You will need to create the spool directory /usr/spool/smb with # appropriate permissions and ownerships for your system. # Set these to the server and service you wish to print to # In this example I have a WfWg PC called "lapland" that has a printer # exported called "printer" with no password. # # Script further altered by hamiltom@ecnz.co.nz (Michael Hamilton) # so that the server, service, and password can be read from # a /usr/var/spool/lpd/PRINTNAME/.config file. # # In order for this to work the /etc/printcap entry must include an # accounting file (af=...): # # cdcolour:\ # :cm=CD IBM Colorjet on 6th:\ # :sd=/var/spool/lpd/cdcolour:\ # :af=/var/spool/lpd/cdcolour/acct:\ # :if=/usr/local/etc/smbprint:\ # :mx=0:\ # :lp=/dev/null: # # The /usr/var/spool/lpd/PRINTNAME/.config file should contain: # server=PC_SERVER # service=PR_SHARENAME # password="password" # # E.g. # server=PAULS_PC # service=CJET_371 # password="" # # Debugging log file, change to /dev/null if you like. # #logfile=/tmp/smb-print.log logfile=/dev/null # # The last parameter to the filter is the accounting file name. # Extract the directory name from the file name. # Concat this with /.config to get the config file. # eval acct_file=\$$# spool_dir=`dirname $acct_file` config_file=$spool_dir/.config # Should read the following variables set in the config file: # server # service # password eval `cat $config_file` # # Some debugging help, change the >> to > if you want to same space. # echo "server $server, service $service" >> $logfile ( # NOTE You may wish to add the line `echo translate' if you want # automatic CR/LF translation when printing. # echo translate echo "print -" cat ) | /usr/local/samba/bin/smbclient "\\\\$server\\$service" \ $password -U $server -N -P >> $logfile ---------------------------------------------------------------------------
À§ ÆÄÀÏÀ» /usr/local/samba/binÀ¸·Î º¹»çÇϰí printcap¿¡ ´ÙÀ½ÀÇ ³»¿ëÀ» »ðÀÔÇÑ´Ù. printcap¿¡ lp¶ó´Â À̸§ÀÌ ÀÌ¹Ì Á¸ÀçÇÑ´Ù¸é, Ãæµ¹À» ÇÇÇϱâ À§ÇØ ¹Ýµå½Ã ´Ù¸¥ À̸§À¸·Î ¹Ù²Ù¾î¾ß ÇÑ´Ù.
------- part of the printcap ---------------------------------------------- lp|laser|ps|SambaPrinter|PostScript:\ lp=/dev/null:sd=/usr/spool/smb:if=/usr/local/samba/bin/smbprint ---------------------------------------------------------------------------
ÀÌ»óÀÇ ÀýÂ÷¿¡ µû¶ó smbprint¸¦ ¼³Ä¡ÇßÀ¸¸ç, printcapÀ» ¼öÁ¤Çß´Ù¸é, /usr/spool/smb µð·ºÅ丮¸¦ ¸¸µé¾î¼ ±×°÷¿¡ ´ÙÀ½ ³»¿ëÀ» Æ÷ÇÔÇÏ´Â .config¶ó´Â À̸§À» °¡Áø ÆÄÀÏÀ» ³Ö¾îµÐ´Ù.
------- .config ----------------------------------------------------------- server=dark service=lp password="" --------------------------------------------------------------------------- (ÁÖÀÇ: server¿Í service Ç׸ñÀº »óȲ¿¡ ¸Â°Ô ¼³Á¤ÇÑ´Ù.)
ÀÌÁ¦ °ü¸®ÀÚ ±ÇÇÑÀ¸·Î lpc ¸í·ÉÀ» »ç¿ëÇÏ¿© ÇÁ¸°ÅÍ lp¸¦ Ȱ¼ºÈ½ÃŲ´Ù. ÀÌ ½ÃÁ¡¿¡¼ Æ÷½ºÆ®½ºÅ©¸³Æ® Çü½ÄÀÇ ÆÄÀÏÀ» Çϳª °ñ¶ó ½ÃÇè Àμ⸦ ÇØº¸¶ó. ¸ðµç °ü·Ã ÆÄÀÏÀ» Á¤È®ÇÏ°Ô ¼³Ä¡ÇßÀ½¿¡µµ ºÒ±¸ÇÏ°í ¸îºÐµ¿¾È ÀμⰡ ÁøÇàµÇÁö ¾ÊÀ¸¸é, ¾îµò°¡¿¡ ¹®Á¦°¡ »ý±ä °ÍÀÌ´Ù. ÀÌ·¸°Ô ½Ã½ºÅÛÀÇ Æ¯¼º Â÷ÀÌ·Î ÀÎÇØ À§ÀÇ ¹æ¹ýÀÌ ÅëÇÏÁö ¾ÊÀ» °æ¿ì¸¦ ´ëºñÇØ ´Ù¸¥ ´ëÃ¥À» °±¸Çغ¸µµ·Ï ÇϰڴÙ(Âü°í: SunOS 4.1.x¿¡¼´Â Á¤»óÀûÀ¸·Î µ¿ÀÛÇÔÀ» È®ÀÎÇÏ¿´´Ù. ±×·¯³ª Digital UNIX¿¡¼´Â printcapÀÇ Â÷ÀÌ·Î ÀÎÇØ Á¦´ë·Î µ¿ÀÛÇÏÁö ¾ÊÀ½À» È®ÀÎÇÏ¿´´Ù.).
´Ù¸¥ ´ëÃ¥À» ¼Ò°³Çϱ⿡ ¾Õ¼ SYSV »ç¿ëÀÚ¸¦ Áñ°Ì°Ô ÇØÁÙ ³»¿ëÀÌ ÀÖ´Ù. ´Ù¸§ÀÌ ¾Æ´Ï¶ó 1.9.17 ¹öÀü¿¡¼´Â SYSV »ç¿ëÀÚ¸¦ À§ÇÑ smbprint.sysv¸¦ Á¦°øÇϰí ÀÖ´Ù. samba-1.9.17p1/examples/printing µð·ºÅ丮 ¾Æ·¡¸¦ Çѹø »ìÆìº¸±â ¹Ù¶õ´Ù. SYSV °è¿¿¡¼ Á¦°øÇÏ´Â lpadmin ¸í·ÉÀ» ÀÌ¿ëÇÏ¿© smbprint.sysv ½© ½ºÅ©¸³Æ®¸¦ Ãß°¡Çϵµ·Ï ÇÑ´Ù.
--------------------- smbprint.sysv ----------------------------------------- # clear out the unwanted parameters shift;shift;shift;shift;shift # now the argument list is just the files to print server=admin service=hplj2 password="" ( # NOTE You may wish to add the line `echo translate' if you want automatic # CR/LF translation when printing. echo translate echo "print -" cat $* ) | /opt/samba/smbclient "\\\\$server\\$service" $password -N -P > /dev/null exit $? --------------------------------------------------------------------------- (¾ÆÁ÷ ÇÊÀÚ°¡ smbprint.sysv ½ºÅ©¸³Æ®¸¦ ½ÃÇèÇØº¸Áö ¾Ê¾ÒÀ¸¹Ç·Î ¾Öµ¶ÀÚ °¡¿îµ¥ ¼º°øÇϽŠºÐ °è½Ã¸é ÀüÀÚ ÆíÁö·Î È®ÀÎÀ» ºÎʵ右´Ï´Ù.)
ÀÌÁ¦ À̵µÀúµµ ¾ÈµÇ´Â ½Ã½ºÅÛÀÇ ¹®Á¦Á¡À» ÇØ°áÇϱâ À§ÇØ, ´ÙÀ½¿¡ °£´ÜÇÑ
csh ½ºÅ©¸³Æ®¸¦ ¼Ò°³ÇÑ´Ù(ÀÛ¼ºÀÚ: kijoo@dice.postech.ac.kr (Kim Ki-joo)).
´ÙÀ½ ÆÄÀÏ(slpr)À» Àû´çÇÑ °÷(¿¹: /usr/local/bin
)¿¡ ¼³Ä¡ÇØµÎ¸é µµ¿òÀÌ
µÉ °ÍÀÌ´Ù. ºñ·Ï Ç¥ÁØ ÀÔ·ÂÀ» ÅëÇÑ ÆÄÀÌÇÁ ¹æ½Ä ¶Ç´Â ÇϳªÀÇ ÀÎÀÚ¸¸À» ¹Þ¾ÆµéÀÌ´Â
Á¦¾àÁ¡ÀÌ ÀÖÁö¸¸, smbprint°¡ µ¿ÀÛÇÏÁö ¾ÊÀ» °æ¿ì ÈǸ¢ÇÑ ´ë¿ëǰÀ¸·Î »ç¿ëÇÒ
¼ö ÀÖ´Ù. ¿ø·¡ ½Ã½ºÅÛ¿¡¼ Á¦°øÇÏ´Â lprÀ» lpr.org·Î º¯°æÇϰí slprÀ» lpr·Î ½Éº¼¸¯
¸µÅ©¸¦ °É¾îµÎ¸é °¨Âʰ°ÀÌ ÀÏ¹Ý »ç¿ëÀÚ¸¦ ¼ÓÀÏ ¼ö ÀÖÀ» °ÍÀÌ´Ù.
--------------------- slpr ------------------------------------------------ #!/bin/csh -f # # printing service using samba # Written by kijoo if ($#argv == 0) then cat - > /tmp/smblpr$$ echo "print /tmp/smblpr$$" | \ /usr/local/samba/bin/smbclient '\\dark\lp' -N -P rm /tmp/smblpr$$ else echo "print $1" | /usr/local/samba/bin/smbclient '\\dark\lp' -N -P endif --------------------------------------------------------------------------- (ÁÖÀÇ: '\\dark\lp' ºÎºÐÀ» »óȲ¿¡ ¸Â°Ô ¼³Á¤ÇÑ´Ù.)
°£´ÜÇÏ°Ô PC¿ë lpd¸¦ ±¸Çؼ ¼³Ä¡ÇÏ´Â ¹æ¹ýµµ ÀÖ´Ù. ÇÏÁö¸¸ ftpd¿Í ¸¶Âù°¡Áö·Î ´ëºÎºÐÀÌ »ó¿ëÀ̹ǷΠºÒÇÊ¿äÇÑ Ãß°¡ºñ¿ëÀÌ µé°Ô µÈ´Ù. ÀÌ·¸°Ô PCÂÊÀ» ÀÌ¿ëÇϸé Á÷·Ä ¼±ÀÌ ¾Æ´Ï¶ó º´·Ä ¼±À» »ç¿ëÇϹǷΠÀμâ¼Óµµ°¡ ȹ±âÀûÀ¸·Î °³¼±µÇ¸ç (³×Æ®¿÷ Ä«µå°¡ ³»ÀåµÈ ÇÁ¸°ÅÍÀÎ °æ¿ì´Â ÇØ´ç ¹«.), À¯´Ð½º »ç¿ë½Ã ¹ß»ýÇÏ´Â Á¦ÇÑµÈ ÇÁ¸°ÅÍ ¹öÆÛ Å©±â ¹®Á¦°¡ ÀúÀý·Î ÇØ°áµÈ´Ù´Â ºÎ°¡ÀûÀÎ ÀåÁ¡ÀÌ ÀÖ´Ù.