unix etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
unix etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

28 Aralık 2011 Çarşamba

Unixden windowsa çıktı gönderme


Bu işlemi yapabilmek için

1- Windowsda printer paylaşılmş durumda olmalı.
2- Windowsda print spooler servisi çalışıyor durumda olmalı. Firewall varsa tanımlarınızı yapmalısınız. spooler servisi varsayılan olarak 515 portunu dinliyor.

Unixden aşağıdaki şekilde çıktı gönderebiliriz.

/usr/ucb/lpr -P HOST_ADI:PRINTER_ADI -l PRINT_DOSYASI

örnek:
/usr/ucb/lpr -P pcramazan:printer33 -l abc.txt



12 Ekim 2011 Çarşamba

Print from unix to windows



TODO

1- Check your printer and share printer on Windows.
2- Check print spooler service runnnig on windows. If you use Firewall check your rules. The spooler service listens 515 port by default.

You can print from unix like below command:

/usr/ucb/lpr -P HOST_NAME:PRINTER_NAME -l PRINT_FILE

HOST_NAME    : name or ip address of pc/server which connected to printer.
PRINTER_NAME : sharing name of windows printer

sample:
/usr/ucb/lpr -P pcramazan:printer33 -l abc.txt

14 Eylül 2011 Çarşamba

Windows print spooler service ports

Print spooler service use below ports for networking.
LPDSVC service accepts from unix LPR printing.

Service NameUDPTCP
Services for Macintosh (uses AppleTalk)
201, 202, 204, 206
201, 202, 204, 206
Internet Printing Protocol (uses HTTP)
80
80
NWLink (uses IPX/SPX)
213
213
LPDSVC (accepts LPR)
515
515
LPR Port (sends LPR)
721-731, >1023
721-731, >1023
Server (using SMB)
137, 138
139
Server (using RPC)
530
530
Standard Port Monitor (using SNMP)
161, 162
161, 162
Standard Port Monitor (using LPR)
> 1023
> 1023
Standard Port Monitor (using RAW)
2000, 2501-2503, 3001, 6869, >=9100
2000, 2501, 2503, 3001, 6869, >=9100
http://technet.microsoft.com/en-us/library/cc783789(WS.10).aspx#w2k3tr_prntt_how_yxcr

19 Aralık 2010 Pazar

Calling Unix command from Oracle database with java

We can use java to calling unix command from database.

there are 2 object for this purpose.


--create java object with below source.
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "unixCommand" AS
import java.io.*;
public class unixCommand{

public static String Run(String Command){

try {
String strReturn = "";
Process proc = Runtime.getRuntime().exec(Command);

BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream())); 
String output = "";
String currentLine = null; 
while((currentLine = in.readLine()) != null) { 
output += currentLine + "\n";
}
in.close();

if(output != "") 
strReturn = "[O]" + output;

in = new BufferedReader(new InputStreamReader(proc.getErrorStream()));  
String error = "";
currentLine = null; 
while((currentLine = in.readLine()) != null) {  
error += currentLine + "\n";  

}
in.close();

if(error != "") 
strReturn += "[E]" + error;

return strReturn;

} catch (Exception e){
System.out.println("[E]Error running command: " + Command + "\n" + e.getMessage());
return(e.getMessage());
}
}
}
-- create db function.
CREATE or REPLACE FUNCTION unixCommand_Run(Command IN STRING)
RETURN VARCHAR2 IS
LANGUAGE JAVA
NAME 'unixCommand.Run(java.lang.String) return java.lang.String';

--sample
select unixCommand_Run('ls -l') from dual;