´ÙÀ½ ÀÌÀü Â÷·Ê

11. ³×Æ®¿÷À¸·Î ¿¬°áµÈ ÇÁ¸°Å͸¦ ÀÌ¿ëÇÏ¿© Ãâ·ÂÇϱâ

(How to print to a printer over the network) lpd´Â ³×Æ®¿÷À¸·Î ¿¬°áµÈ ´Ù¸¥ ±â°è¿¡ ¿¬°áµÈ ÇÁ¸°Å͸¦ ÅëÇؼ­ Ãâ·ÂÇÏ´Â °ÍÀ» Áö¿øÇÑ´Ù. ÇÊÅÍ ¹× ÀûÀýÇÑ À¯Æ¿¸®Æ¼¸¦ ÀÌ¿ëÇÑ´Ù¸é ¸ðµç ³×Æ®¿÷ ȯ°æ¿¡¼­ lprÀ» ÀÌ¿ëÇؼ­ ½±°Ô Ãâ·ÂÇÒ ¼ö ÀÖ´Ù.

11.1 À¯´Ð½º/lpd È£½ºÆ®·Î Ãâ·Â (To a Unix/lpd host)

¿ø°ÝÁöÀÇ ±â°è°¡ ´ç½ÅÀÇ ¸®´ª½º ¹Ú½º¿¡ ¿¬°áµÈ ÇÁ¸°ÅÍ·Î Ãâ·ÂÇÏ´Â °ÍÀ» Çã°¡ÇÏ·Á¸é /etc/hosts.equiv³ª /etc/hosts.lpd¿¡ ÇØ´ç±â°è(ÀÇ ÁÖ¼Ò³ª À̸§)¸¦ µî·ÏÇØ¾ß ÇÑ´Ù.

(hosts.equiv¿¡´Â ´Ù¸¥ ¿ªÇÒÀ» Çϴ ȣ½ºÆ®ÀÇ À̸§µµ ´ã°í ÀÖ´Ù. ÀÓÀÇÀÇ ±â°è¸¦ µî·ÏÇÑ´Ù¸é ½ÅÁßÇÏ°Ô Ç϶ó) /etc/printcapÀÇ "rs" Ư¼ºÀ» ÀÌ¿ëÇÏ¿© ´Ù¸¥ ±â°èÀÇ Æ¯Á¤ »ç¿ëÀÚ¸¸ ´ç½ÅÀÇ ÇÁ¸°ÅÍ¿¡ Á¢±ÙÇÒ ¼ö ÀÖµµ·Ï ÁöÁ¤ÇÒ ¼ö ÀÖ´Ù; ¿©±â¿¡ ´ëÇÑ ÀÚ¼¼ÇÑ °ÍÀº lpdÀÇ ¸ÇÆäÀÌÁö¸¦ Âü°íÇ϶ó.

11.2 lpd¸¦ ÀÌ¿ëÇÏÀÚ (With lpd)

´Ù¸¥ ±â°è·Î Ãâ·ÂÇÏ·Á¸é /etc/printcap¿¡ ´ÙÀ½°ú °°ÀÌ Á¤ÀÇÇØ¾ß ÇÑ´Ù.

# REMOTE djet500
lp|dj|deskjet:\
:sd=/var/spool/lpd/dj:\
:rm=machine.out.there.com:\
:rp=printername:\
:lp=/dev/null:\
:sh:
remote machineÀ¸·Î Ãâ·ÂÇÏ´Â °æ¿ì¿¡µµ lpd°¡ µ¹¾Æ°¡´Â local machine (ÀÚ½ÅÀÇ ¸®´ª½º ¹Ú½º)¿¡ ½ºÇ®µð·ºÅ丮°¡ Á¸ÀçÇÑ´Ù´Â Á¡¿¡ ÁÖ¸ñÇ϶ó. ¸¸¾à remote machineÀÌ ´Ù¸¥ ÀÛ¾÷¶§¹®¿¡ ¹Ù»Ú°Å³ª Àü¿øÀÌ ²¨Áø »óŶó¸é local machine¿¡¼­ Áö½ÃÇÑ ÇÁ¸°Æ® ÀÛ¾÷Àº ½ºÇ® ¿µ¿ª(¿¹. ½ºÇ®µð·ºÅ丮)¿¡ ´ë±âÇÏ°í ÀÖ´Ù°¡ Ãâ·ÂÀÌ °¡´ÉÇØÁö¸¸ ´Ù½Ã Àü¼ÛµÈ´Ù.

11.3 rlprÀ» ÀÌ¿ëÇÏÀÚ(With rlpr)

lpdÀÇ È¯°æÀ» ¼³Á¤ÇÏ´Â °ñÄ¡¾ÆÇ °úÁ¤À» °ÅÄ¥ ÇÊ¿ä ¾øÀÌ rlprÀ» ÀÌ¿ëÇÑ´Ù¸é °¢°¢ÀÇ ÇÁ¸°Æ® ÀÛ¾÷À» °ð¹Ù·Î(directly) remote machineÀÇ ÇÁ¸°Æ® Å¥·Î Àü¼Û ÇÑ´Ù.¾ÆÁÖ °¡²û¾¿ ¿©·¯ Á¾·ùÀÇ ÇÁ¸°Å͸¦ »ç¿ëÇϴ ȯ°æ¿¡¼­ À¯¿ëÇÏ´Ù . rlpr ¹ßÇ¥¹®¿¡¼­ ÀοëÇϸé: rlprÀº TCP/IP ¸¦ ÀÌ¿ëÇÏ¿© ÇÁ¸°Æ® ÀÛ¾÷À» ³×Æ®¿÷ »óÀÇ À§Ä¡¿¡ Á¦¾à¹ÞÁö ¾Ê°í lpd ¼­¹ö·Î Àü¼ÛÇÒ ¼ö ÀÖ´Ù. lpr°ú´Â ´Þ¸® ÀÛ¾÷À» Àü¼ÛÇÏ´Â ÃøÀÇ ±â°è¿¡°Ô(local machine) ¿ø°ÝÁöÀÇ ±â°è(remote machine)°¡ µî·ÏµÉ(¿¹¸¦ µé¾î /etc/printcap) ÇÊ¿ä°¡ ¾ø´Ù. µû¶ó¼­, rlprÀº Á» ´õ À¯¿¬ÇÏ°í (»ó´ëÀûÀ¸·Î) °ü¸®°¡ ÆíÇÏ´Ù. rlprÀº lprÀÌ »ç¿ëµÇ´Â ¸ðµç ȯ°æ¿¡¼­ »ç¿ë°¡´ÉÇϸç, ÀüÅëÀûÀÎ BSD lpr°ú ÇÏÀ§È£È¯¼º(backwares compatible)À» °¡Áø´Ù. rlprÀÇ ÈǸ¢ÇÑ Á¡Àº ƯÁ¤ ½Ã½ºÅÛ¿¡ ´ëÇؼ­ °í·Á ÇÒ ÇÊ¿ä¾øÀÌ ¸ðµç °÷¿¡¼­ Àü¼Û/Ãâ·ÂÀÌ °¡´ÉÇÏ´Ù´Â °ÍÀÌ´Ù. ¶ÇÇÑ ÀüÅëÀûÀÎ lpró·³ ÇÊÅÍ·Î ÀÛµ¿ÇÏ¿© ¿ø°ÝÁöÀÇ ±â°è¿¡¼­ ½ÇÇàµÇ´Â netscape, xemacs µîÀÇ Å¬¶óÀ̾ðÆ® ÇÁ·Î±×·¥¿¡¼­ local machineÀ¸·Î ½±°Ô Ãâ·ÂÇÒ ¼ö ÀÖ´Ù. rlprÀº ¼±»çÀÌÆ®(SunSite)¿¡¼­ ±¸ÇÒ ¼ö ÀÖ´Ù. < sunsite.unc.edu/pub/Linux/system/Printing/>.

11.4 À©µµ 95/NT, LanManager, Samba·Î ¿¬°áµÈ ÇÁ¸°ÅÍ·Î Ãâ·Â

lpd Å¥¿¡ µé¾îÀÖ´Â ÇÁ¸°Æ® ÀÛ¾÷ÀÇ ³»¿ëÀ» smbclient (sambaÆÐÅ°ÁöÁß ÀϺÎ) ¸¦ ÀÌ¿ëÇؼ­ TCP/IP±â¹ÝÀÇ SMB ÇÁ¸°Æ® ¼­¹ö·Î Á÷Á¢ Àü¼ÛÀÌ °¡´ÉÇÏ´Ù.samba ÆÐÅ°ÁöÀÇ smbprint¶ó´Â ½ºÅ©¸³Æ® ÆÄÀÏÀ» ÀÌ¿ëÇÏ¸é µÈ´Ù. °£´ÜÈ÷ ¼³¸íÇϸé, ½ºÇ® µð·ºÅ丮¿¡ ƯÁ¤ ÇÁ¸°ÅÍ¿ë ¼³Á¤ ÆÄÀÏÀ» Áý¾î ³Ö°í, smbprint ½ºÅ©¸³Æ® ¸¦ /etc/printcapÀÇ "if"·Î ¼³Ä¡ÇÏ¸é µÈ´Ù. /etc/printcapÀÇ ³»¿ëÀº ´ÙÀ½°ú ºñ½ÁÇÒ °ÍÀÌ´Ù.

lp|remote-smbprinter:\
:lp=/dev/null:sh:\
:sd=/var/spool/lpd/lp:\
:if=/usr/local/sbin/smbprint:
smbprint ½ºÅ©¸³Æ®¿¡ Æ÷ÇÔµÈ ¹®¼­¸¦ ¹Ýµå½Ã ÀÐ¾î º¼ °ÍÀ» ±ÇÀåÇÑ´Ù. lpd¸¦ ÇÊ¿ä·Î ÇÏÁö ¾Ê°í smbclinet¸¦ ÀÌ¿ëÇÏ¿© SMB printing ¼­¹ö·Î ÆÄÀÏÀ» Á÷Á¢ Àü¼ÛÇÏ´Â ¹æ¹ýµµ °¡´ÉÇÏ´Ù. ÀÚ¼¼ÇÑ °ÍÀº ¸ÇÆäÀÌÁö¸¦ Âü°íÇ϶ó.

11.5 ³×Æ®¿þ¾î ÇÁ¸°ÅÍ »ç¿ë(To a NetWare Printer)

"ncpfs" ÆÐÅ°Áö¿¡ Æ÷ÇÔµÈ nprint´Â NetWare ȯ°æ¿¡¼­ smbprint¿Í µ¿ÀÏÇÑ ±â´ÉÀ» ¼öÇàÇÑ´Ù. ncpfs´Â < linux01.gwdg.de/pub/ncpfs/> ¿¡¼­ ±¸ÇÒ ¼ö ÀÖ´Ù. ´ÙÀ½Àº LSMÀÇ ³»¿ëÀÌ´Ù.

version 0.16:
With ncpfs you can mount volumes of your netware server under
Linux. You can also print to netware print queues and spool netware
print queues to the Linux printing system. You need kernel 1.2.x or
1.3.54 and above. ncpfs does NOT work with any 1.3.x kernel below
1.3.54.   
lpd¸¦ ÅëÇÏ¿© nprint°¡ ÀÛµ¿Çϱâ À§Çؼ­´Â NetWare(·Î ¿¬°áµÈ)ÇÁ¸°ÅÍ·Î (Ç¥ÁØ)Ãâ·ÂÀ» ³Ñ±â´Â ÀÛÀº ½© ½ºÅ©¸³Æ®¸¦ ÀÛ¼ºÇÏ¿© ÀÌ°ÍÀ» lpd ÇÁ¸°ÅÍ Å¥ ÀÇ "if"·Î ¼³Ä¡ÇØ¾ß ÇÑ´Ù. ´ÙÀ½ÀÇ ³»¿ë°ú ºñ½ÁÇÒ °ÍÀÌ´Ù.
sub2|remote-NWprinter:\
:lp=/dev/null:sh:\
:sd=/var/spool/lpd/sub2:\
:if=/var/spool/lpd/nprint-script:
nprint-scriptÀÇ ³»¿ëÀº ´ÙÀ½°ú °°´Ù.
#! /bin/sh
/usr/local/bin/nprint -S net -U name -P passwd -q printq-q
-

11.6 EtherTalk (¾ÖÇÃ) ÇÁ¸°ÅÍ·Î Ãâ·Â(To an EtherTalk (Apple) printer)

netatalk ÆÐÅ°Áö¿¡´Â nprint³ª smbclient¿Í ºñ½ÁÇÑ ¿ªÇÒÀ» ÇÏ´Â ÇÁ·Î±×·¥ÀÌ ÀÖ´Ù. Werner EugsterÀÇ ¹®¼­¿¡¼­ ¾ÖÇà ³×Æ®¿÷¿¡¼­ÀÇ ÇÁ¸°ÅÍ Ãâ·Â °úÁ¤¿¡ ´ëÇØ ÀÚ¼¼È÷ ¼³¸íÇÏ°í ÀÖ´Ù. ±×ÀÇ È¨ÆäÀÌÁö¸¦ Âü°íÇ϶ó. < garnet.berkeley.edu/~weugster/appleprint.html> È®½ÇÇÏÁö ¸øÇÑ ¼Ò¹® : Netatalk´Â DEC tulip ĨÀ» ÀåÂøÇÑ SMC Etherpower PCIÄ«µå¿¡¼­´Â ÀÛµ¿ÇÏÁö ¾Ê´Â´Ù°í ÇÑ´Ù.

11.7 HP ¹× ±âŸ ³×Æ®¿÷ ÇÁ¸°ÅÍ·Î Ãâ·Â(To an HP or other ethernet printer)

HP¹× ÀϺΠÇÁ¸°ÅÍ¿¡ ÀÖ´Â ethernet ÀÎÅÍÆäÀ̽º¸¦ ÀÌ¿ëÇϸé lpd¸¦ ÀÌ¿ëÇؼ­ ÀڷḦ Á÷Á¢ Àü¼Û/Ãâ·ÂÇÒ ¼ö ÀÖ´Ù. ÇÁ¸°Åͳª ÀÌ´õ³Ý ¾î´ðÅÍ¿¡ Æ÷ÇÔµÈ ¸Å´º¾ó À» ÀÚ¼¼È÷ ÀÐ°í ±× Áö½Ã´ë·Î µû¸£¸é µÈ´Ù. º¸Åë À̵é ÇÁ¸°ÅÍ´Â lpd¸¦ ½ÇÇà Çϸ鼭 Çϳª ÀÌ»óÀÇ ³í¸®Àû ÇÁ¸°ÅÍ Å¥¸¦ Á¦°øÇÑ´Ù. HP Á¦Ç°Àº ´ÙÀ½°ú °°ÀÌ /etc/printcap¿¡ ¼³Á¤µÉ ¼ö ÀÖ´Ù.

lj-5|remote-hplj:\
:lp=/dev/null:sh:\
:sd=/var/spool/lpd/lj-5:\
:rm=printer.name.com:rp=raw:
±Ô¸ð°¡ Å« °÷¿¡¼­, ƯÈ÷ ¸î¸î ÇÁ¸°ÅÍ°¡ PS¸¦ Áö¿øÇÏÁö ¸øÇÒ ¸¸Å­ Å©´Ù¸é, Àü¿ëÀÇ print server¸¦ ±¸ÃàÇÏ°í ±× ¼­¹ö·Î ¸ðµç ÇÁ¸°ÅÍ ÀÛ¾÷À» Àü¼ÛÇÏ¿© ±× ¼­¹ö¿¡¼­ Ghostscript ÀÛ¾÷ÀÌ ¼öÇàµÇ¾î 󸮵Ǵ °ÍÀÌ ¹Ù¶÷Á÷ÇÏ´Ù.

¿À·¡µÈ HP Á¦Ç°(To older HPs)

ÀϺΠÇÁ¸°ÅÍ(¶Ç´Â "ºí·¢¹Ú½º"·Î ĪÇÏ´Â ³×Æ®¿÷ Á¦Ç°µé)´Â ¼ø¼öÇÑ TCP Á¢¼Ó°úÁ¤ÀÇ Ç¥ÁØÀÌ ¾Æ´Ñ ¹æ¹ý¸¸À» Áö¿øÇÑ´Ù. ÀÌ·¯ÇÑ ¹üÁÖ¿¡ ¼ÓÇÏ´Â Á¦Ç°¿¡´Â JetDirect Ãʱ⠸ðµ¨(ÀϺΠJetDirectEx Á¦Ç° Æ÷ÇÔ)ÀÌ ÀÖ´Ù. ±âº»ÀûÀ¸·Î, À̵é ÇÁ¸°ÅÍ·Î Ãâ·ÂÇÏ·Á¸é ƯÁ¤ Æ÷Æ®·Î (ÁÖ·Î 9100) tcp Á¢¼ÓÀ» ÇÏ¿© ÇÁ¸°ÅÍ ÀÛ¾÷ ÀڷḦ Àü¼ÛÇÏ¸é µÈ´Ù. ÀÌ°ÍÀ» ±¸ÇöÇÏ´Â ¹æ¹ý Àº ¿©·¯°¡Áö°¡ ÀÖÀ¸³ª, ´ÙÀ½¿¡¼­´Â PerlÀ» ÀÌ¿ëÇÞ´Ù.


#!/usr/bin/perl
# Thanks to Dan McLaughlin for writing the original version
of this
# script (And to Jim W. Jones for sitting next to Dan when
writing me
# for help ;)
$fileName = @ARGV[0];
open(IN,"$fileName") || die "Can't open file
$fileName";
$dpi300 = "\x1B*t300R";
$dosCr = "\x1B&amp;k3G";
$ends = "\x0A";
$port = 9100 unless $port;
$them = "bach.sr.hp.com" unless $them;
$AF_INET = 2;
$SOCK_STREAM = 1;
$SIG{'INT'} = 'dokill';
$sockaddr = 'S n a4 x8';
chop($hostname = `hostname`);
($name,$aliases,$proto) = getprotobyname('tcp');
($name,$aliases,$port) = getservbyname($port,'tcp')
unless $port =~ /^\d+$/;;
($name,$aliases,$type,$len,$thisaddr) =
gethostbyname($hostname);
($name,$aliases,$type,$len,$thataddr) = gethostbyname($them);
$this = pack($sockaddr, $AF_INET, 0, $thisaddr);
$that = pack($sockaddr, $AF_INET, $port, $thataddr);
if (socket(S, $AF_INET, $SOCK_STREAM, $proto)) {
# print "socket ok\n";
}
else {
die $!;
}
# Give the socket an address.
if (bind(S, $this)) {
# print "bind ok\n";
}
else {
die $!;
}
# Call up the server.
if (connect(S,$that)) {
# print "connect ok\n";
}
else {
die $!;
}
# Set socket to be command buffered.
select(S); $| = 1; select(STDOUT);
# print S "@PJL ECHO Hi $hostname! $ends";
# print S "@PJL OPMSG DISPLAY=\"Job $whoami\"
$ends";
# print S $dpi300;
# Avoid deadlock by forking.
if($child = fork) {
print S $dosCr;
print S $TimesNewR;
while (<IN>) {
print S;
}
sleep 3;
do dokill();
} else {
while(<S>) {
print;
}
}
sub dokill {
kill 9,$child if $child;
}

11.8 remote printer¿ë if ½ÇÇà (Running an if for remote printers)

lpdÀÇ Æ¯Â¡Àº ¿ø°ÝÁöÀÇ ÇÁ¸°ÅÍ(remote printer)¿ë "if"´Â ½ÇÇàµÇÁö ¾Ê´Â´Ù´Â °ÍÀÌ´Ù. "if"¸¦ ½ÇÇàÇϱâ À§Çؼ­ µÎ°³ÀÇ ÇÁ¸°Å͸¦ Á¤ÀÇÇÏ°í ÇÁ¸°ÅÍ ÀÛ¾÷À» Çѹø ´õ ó¸®ÇÑ´Ù. ±×·¯ÇÑ ¿¹·Î ´ÙÀ½ÀÇ printcapÀ» Âü°íÇ϶ó.


lj-5:remote-hplj:\
:lp=/dev/null:sh:\
:sd=/var/spool/lpd/lj-5:\
:if=/usr/lib/lpd/filter-lj-5:
lj-5-remote:lp=/dev/null:sh:rm=printer.name.com:\
:rp=raw:sd=/var/spool/lpd/lj-5-raw:
filter-lj-5 scriptÀÇ ³»¿ëÀº ´ÙÀ½°ú °°´Ù.
#!/bin/sh
gs <options> -q -dSAFER -sOutputFile=- - | \
lpr -Plj-5-remote -U$5

-U ¿É¼ÇÀ¸·Î lprÀº (º¹»çº»ÀÎ)lprÀÌ ´ë¸ó(daemon)À¸·Î ½ÇÇàµÇ°í ÀÖ´Ù¸é óÀ½ Ãâ·Â ¸í·ÉÀ» Áö½ÃÇÑ »ç¶÷ÀÇ À̸§ÀÌ ´Ù½Ã 󸮵Ǵ ÇÁ¸°ÅÍ ÀÛ¾÷¿¡ µ¿ÀÏ ÇÏ°Ô ÁöÁ¤µÈ´Ù. usernameÀ» ¹Þ´Â ¹æ¹ýÀ¸·Î Á» ´õ ³ªÀº(robust)¹æ¹ýÀ» »ç¿ëÇØ ¾ß ÇÒ °ÍÀÌ´Ù. ¿Ö³ÄÇϸé Ưº°ÇÑ °æ¿ì $5(argument 5)°¡ ¾Æ´Ò¼öµµ ÀÖ´Ù. printcapÀÇ ¸ÇÆäÀÌÁö¸¦ Âü°íÇ϶ó.
´ÙÀ½ ÀÌÀü Â÷·Ê