next up previous
Next: °í½ºÆ®½ºÅ©¸³Æ®¿Í ¿¬µ¿ÇÑ Àμ⠹æ¹ý Up: »ï¹ÙÀÇ È°¿ë ¹æ¾È Previous: PC ÂÊÀÇ »ç¿ëÀÚ µð½ºÅ©

PC ÂÊÀÇ ³×Æ®¿÷ ÇÁ¸°ÅÍ ¿¬°á

À¯´Ð½º ±â°è¿¡¼­ PCÂÊ¿¡ ¿¬°áµÈ ÇÁ¸°Å͸¦ °øÀ¯ÇÏ°í ½ÍÀ» °æ¿ì°¡ ÀÖÀ» °ÍÀÌ´Ù. ÇÁ¸°ÅÍ °øÀ¯±â¸¦ ±¸¸ÅÇؼ­ ¿¬°áÇÏ´Â ¹æ¹ýÀÌ °¡Àå ½±Áö¸¸, ºÎ°¡ ºñ¿ëÀÌ µé°Ô µÈ´Ù. ´ÙÀ½ÀÇ ¹æ¹ýÀ» »ý°¢Çغ¸ÀÚ.

  1. ¿¹·Î NetBIOS À̸§ÀÌ darkÀ̶ó´Â PC¿¡ ¿¬°áµÈ lp¶ó´Â À̸§À» °¡Áø °øÀ¯ ÇÁ¸°Å͸¦ reuse.postech.ac.krÀ̶ó´Â À̸§À» °¡Áø UNIX ±â°è¿¡¼­ »ç¿ëÇÏ°í ½Í´Ù°í °¡Á¤ÇÏÀÚ.
  2. reuse¿¡¼­ smbclient¸¦ ´ÙÀ½°ú °°ÀÌ µ¿ÀÛ½ÃŲ´Ù.
    % smbclient '\\dark\lp' -P -N
    (P ¼±Åà »ç¾çÀº ÇÁ¸°Å͸¦ ÀǹÌ, N ¼±Åà »ç¾çÀº Æнº¿öµå ÀÔ·ÂÀ» °Ç³Ê¶Ù´Â °ÍÀ» ÀǹÌ)
  3. lcd ¸í·ÉÀ» »ç¿ëÇÏ¿© ÀμâÇÏ°í ½ÍÀº ÆÄÀÏÀÌ ÀÖ´Â °÷À¸·Î °£´Ù.
    smb: \> lcd /usr/local/lib/ghostscript/examples
  4. put ¸í·ÉÀ» »ç¿ëÇÏ¿© ÀμâÇÒ ÆÄÀÏÀ» ÇÁ¸°ÅÍ·Î º¸³½´Ù. ÇÁ¸°ÅÍ´Â Æ÷½ºÆ®½ºÅ©¸³Æ®¸¦ Áö¿øÇÑ´Ù°í °¡Á¤ÇÑ´Ù.
    smb: \> put tiger.ps
  5. ÇÁ¸°ÅÍ·Î °¡¼­ Àμ⠰á°ú¸¦ È®ÀÎÇÑ´Ù.

ŸÀÌÇÎÀ» ½È¾îÇϽô ºÐÀ» À§ÇØ ºñ·Ï Ç¥ÁØ »ï¹Ù ÆÐÅ°Áö¿¡´Â Æ÷ÇԵǾî ÀÖÁö ¾ÊÁö¸¸ 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ÂÊÀ» ÀÌ¿ëÇϸé Á÷·Ä ¼±ÀÌ ¾Æ´Ï¶ó º´·Ä ¼±À» »ç¿ëÇϹǷΠÀμâ¼Óµµ°¡ ȹ±âÀûÀ¸·Î °³¼±µÇ¸ç (³×Æ®¿÷ Ä«µå°¡ ³»ÀåµÈ ÇÁ¸°ÅÍÀÎ °æ¿ì´Â ÇØ´ç ¹«.), À¯´Ð½º »ç¿ë½Ã ¹ß»ýÇÏ´Â Á¦ÇÑµÈ ÇÁ¸°ÅÍ ¹öÆÛ Å©±â ¹®Á¦°¡ ÀúÀý·Î ÇØ°áµÈ´Ù´Â ºÎ°¡ÀûÀÎ ÀåÁ¡ÀÌ ÀÖ´Ù.



¹ÚÀçÈ£
1999³â2¿ù26ÀÏ (±Ý), ¿ÀÈÄ 3½Ã9ºÐ25ÃÊ