Running Shell Commands (not Executable) in Unix from Java
What are my options to run shell commands from Java?
My goal is to change my existing shell environment variables to some new ones provided by .anotherProfile.
Using an executable from Java is not an option because it does not work i.e. ( exec(". /home/.profile") ) brings up errors.
Someone has suggested that I start a child shell with that profile and work from there, but I'm unfamiliar with that sort of syntax and programming in general.
Any good help equals duke dollars :)
Well there are some possibilities. In the original thread you mentioned that you wanted the shell script to be executed to change some enviroment parameters of the shell the JVM is executing in.
If so, and you are able to rewrite the profile so you can parse it manually. Then you can change some environment setting by writing the JNI wrappers for the getenv and setenv system calls. (Check your man pages)
That will change the environment. I am just wondering what good it will do for you? What's use of sourcing the profile in a JVM?
Similar Messages
-
Maxl shell command not executing
I'm running Essbase from a Solaris environment. I have a MAXL script that exports an Essbase database, shuts down Essbase, and issues shell commands to copy the Analytic Services directories to backup directories. The script was running without problems until a Solaris patch, generic patch 127111-09, was installed. Since then the shell commands are no longer executing. Does anyone know why these shell commands are no longer executing.
Thanks,
TomAlready checked, no change in the permissions. There was a bug, see link, when doing a recursive remove that was corrected. Not sure if this is related.
Link: [http://bugs.opensolaris.org/bugdatabase/view_bug.do;jsessionid=fa9dddbcb3ede12a9d5b4a397cef?bug_id=4677347]
Thanks,
Tom -
Run shell commands using java program
Hi guys,
I am trying to run shell commands like cd /something and ./command with arguments as follows, but getting an exception that ./command not found.Instead of changing directory using "cd" command I am passing directory as an argument in rt,exec().
String []cmd={"./command","arg1", "arg2", "arg3"};
File file= new File("/path");
try{
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(cmd,null,file);
proc.waitFor();
System.out.println(proc.exitValue())
BufferedReader buf = new BufferedReader(new InputStreamReader(proc.getInputStream()));
catch(Exception e)
{e.printStackTrace();
So can anyone please tell me what is wrong with this approach? or is there any better way to do this?
Thanks,
Hardikwarnerja wrote:
What gives you the idea that the process to execute is called "./command"? If this is in Windows, it is "cmd.exe" for example.It does not have to be cmd.exe in Windows. Any executable or .bat file can be executed as long as one either specifies the full path or the executable is in a directory that is in the PATH.
On *nix the file has to have the executable bit set and one either specifies the full path or the executable must be in a directory that is in the PATH . If the executable is a script then if there is a hash-bang (#!) at the start of the first line then the rest of the line is taken as the interpreter to use. For example #!/bin/bash or #!/usr/bin/perl .
One both window and *nix one can exec() an interpreter directly and then pass the commands into the process stdin. The advantage of doing this is that one can change the environment in one line and it remains in effect for subsequent line. A simple example of this for bash on Linux is
import java.io.OutputStreamWriter;
import java.io.Writer;
public class ExecInputThroughStdin
public static void main(String args[]) throws Exception
final Process process = Runtime.getRuntime().exec("bash");
new Thread(new PipeInputStreamToOutputStreamRunnable(process.getErrorStream(), System.err)).start();
new Thread(new PipeInputStreamToOutputStreamRunnable(process.getInputStream(), System.out)).start();
final Writer stdin = new OutputStreamWriter(process.getOutputStream());
stdin.write("xemacs&\n");
stdin.write("cd ~/work\n");
stdin.write("dir\n");
stdin.write("ls\n");
stdin.write("gobbldygook\n"); // Forces output to stderr
stdin.write("echo $PATH\n");
stdin.write("pwd\n");
stdin.write("df -k\n");
stdin.write("ifconfig\n");
stdin.write("echo $CWD\n");
stdin.write("dir\n");
stdin.write("cd ~/work/jlib\n");
stdin.write("dir\n");
stdin.write("cat /etc/bash.bashrc\n");
stdin.close();
final int exitVal = process.waitFor();
System.out.println("Exit value: " + exitVal);
}One can use the same approach with Windows using cmd.exe but then one must be aware of the syntactic differences between commands running in .bat file and command run from the command line. Reading 'help cmd' s essential here.
The class PipeInputStreamToOutputStreamRunnable in the above example just copies an InputStream to an OutputStream and I use
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class PipeInputStreamToOutputStreamRunnable implements Runnable
public PipeInputStreamToOutputStreamRunnable(InputStream is, OutputStream os)
is_ = is;
os_ = os;
public void run()
try
final byte[] buffer = new byte[1024];
for (int count = 0; (count = is_.read(buffer)) >= 0;)
os_.write(buffer, 0, count);
} catch (IOException e)
e.printStackTrace();
private final InputStream is_;
private final OutputStream os_;
} -
Running shell commands in pre-post session commands
Hi Nikita: It depends on what kind of OS your Secure Agent is running on. If you're running your Secure Agent on Windows, you can enter DOS commands into these fields which may include SQL scripts using batch files. Similarly, if you're running your Secure Agent on Linux you can enter shell commands which may include SQL scripts using shell scripts. You should be able to find some examples of these commands from other Informatica Cloud users by searching the Community. Hope this helps,Josh
Hi all,I am new to informatica, can anyone please explain me how should i run shell commands in pre/post session commands?and what type of shell scripting is usually needed for the informatica jobs? Thank you
-
[Solved] stumpwm: how to get rid of newline using run-shell-command
Hi all,
in order to set up my mode-line for stumpwm, I've been using the commad
run-shell-command such as in:
(setf *screen-mode-line-format*
(list
'(:eval (run-shell-command "date" t))
'(:eval (run-shell-command "date" t))))
However, each instance of run-shell-command creates an unnecessary
newline (so that my mode line contains two lines without necessity).
Do you know how I can get rid of this newline?
Thanks!
Last edited by falsum (2011-05-23 07:12:27)jiyuu wrote:
I didn't test it but the function you want is 'string-trim' or 'string-right-trim'.
You use it like this:
(string-trim '(#\Newline) my-string)
So in your case:
(setf *screen-mode-line-format*
(list
'(:eval (string-trim '(#\Newline)
(run-shell-command "date" t)))
'(:eval (run-shell-command "date" t))))
That works perfectly well. Thanks a lot jiyuu!! -
Executing batch file from Java stored procedure hang
Dears,
I'm using the following code to execute batch file from Java Stored procedure, which is working fine from Java IDE JDeveloper 10.1.3.4.
public static String runFile(String drive)
String result = "";
String content = "echo off\n" + "vol " + drive + ": | find /i \"Serial Number is\"";
try {
File directory = new File(drive + ":");
File file = File.createTempFile("bb1", ".bat", directory);
file.deleteOnExit();
FileWriter fw = new java.io.FileWriter(file);
fw.write(content);
fw.close();
// The next line is the command causing the problem
Process p = Runtime.getRuntime().exec("cmd.exe /c " + file.getPath());
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while ((line = input.readLine()) != null)
result += line;
input.close();
file.delete();
result = result.substring( result.lastIndexOf( ' ' )).trim();
} catch (Exception e) {
e.printStackTrace();
result = e.getClass().getName() + " : " + e.getMessage();
return result;
The above code is used in getting the volume of a drive on windows, something like "80EC-C230"
I gave the SYSTEM schema the required privilege to execute the code.
EXEC DBMS_JAVA.grant_permission('SYSTEM', 'java.io.FilePermission', '<<ALL FILES>>', 'read ,write, execute, delete');
EXEC DBMS_JAVA.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
EXEC DBMS_JAVA.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
GRANT JAVAUSERPRIV TO SYSTEM;
I have used the following to load the class in Oracle 9ir2 DB:
loadjava -u [system/******@orcl|mailto:system/******@orcl] -v -resolve C:\Server\src\net\dev\Util.java
CREATE FUNCTION A1(drive IN VARCHAR2) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'net.dev.Util.a1(java.lang.String) return java.lang.String';
variable serial1 varchar2(1000);
call A1( 'C' ) into :serial1;
The problem that it hangs when I execute the call to the function (I have indicated the line causing the problem in a comment in the code).
I have seen similar problems on other forums, but no solution posted
[http://oracle.ittoolbox.com/groups/technical-functional/oracle-jdeveloper-l/run-an-exe-file-using-oracle-database-trigger-1567662]
I have posted this in JDeveloper forum ([t-853821]) but suggested to post for forum in DB.
Can anyne help?Dear Peter,
You are totally right, I got this as mistake copy paste. I'm just having a Java utility for running external files outside Oracle DB, this is the method runFile()
I'm passing it the content of script and names of file to be created on the fly and executed then deleted, sorry for the mistake in creating caller function.
The main point, how I claim that the line in code where creating external process is the problem. I have tried the code with commenting this line and it was working ok, I made this to make sure of the permission required that I need to give to the schema passing security permission problems.
The function script is running perfect if I'm executing vbs script outside Oracle using something like "cscript //NoLogo aaa1.vbs", but when I use the command line the call just never returns to me "cmd.exe /c bb1.bat".
where content of bb1.bat as follows:
echo off
vol C: | find /i "Serial Number is"
The above batch file just get the serial number of hard drive assigned when windows formatted HD.
Same code runs outside Oracle just fine, but inside Oracle doesn't return if I exectued the following:
variable serial1 varchar2(1000);
call A1( 'C' ) into :serial1;
Never returns
Thanks for tracing teh issue to that details ;) hope you coul help. -
Update environment variables of unix from java
i want to update DISPLAY environment variable in unix from java.
(very urgent).Basically not possible. The environmental variables belong to a particular task, typically the shell, and your JVM process just has a copy. If you create another task (with Runtime.exec) you can specify whatever environmental variables you like but it's always the parent that supplies them to the child, not the other way arround. (export is handled internally by the shell's own task, it's not a program of it's own).
-
Is it possible to execute SAPGUI scripts from java program?
Hi everyone..
I need to develop an java applications that executes the SAPGUI script or any technique that execute set of transaction as client.
Is it possible to execute SAPGUI scripts from java program? if so, how it can be achieved? is there any other technique to achieve above mention scenario?.
it will be more helpful, if docs related to that are shared..
Thanks in advanceOh, bummer. Would be much more convenient if I could just use iTunes for everything. Can't stand WMP. I wonder if WinAmp might be a good compromise?
Thanks for this answer . . .
Sharon -
Shell Commands not found error when running application
Hello,
Im using MonoDevelop IDE in my Mac, before it used to work fine but after few days, now when I'm opening the application nothing happens., i checked the Console for the log and it says this
May 9 21:29:39 Sri-Vishnu-Totakuras-MacBook-Pro [0x0-0x52052].com.ximian.monodevelop[1510]: /Applications/MonoDevelop.app/Contents/MacOS/monodevelop: line 17: dirname: command not found
May 9 21:29:39 Sri-Vishnu-Totakuras-MacBook-Pro [0x0-0x52052].com.ximian.monodevelop[1510]: /Applications/MonoDevelop.app/Contents/MacOS/monodevelop: line 31: //mono-version-check: No such file or directory
May 9 21:29:39 Sri-Vishnu-Totakuras-MacBook-Pro com.apple.launchd.peruser.501[599] ([0x0-0x52052].com.ximian.monodevelop[1510]): Exited with code: 1
I thought may be some error with the "dirname" command, so i commented it in the code and gave the path of directory myself and then the console shows up like this.
May 9 21:34:12 Sri-Vishnu-Totakuras-MacBook-Pro [0x0-0x56056].com.ximian.monodevelop[1532]: /Applications/MonoDevelop.app/Contents/MacOS//mono-version-check: line 19: grep: command not found
May 9 21:34:12 Sri-Vishnu-Totakuras-MacBook-Pro [0x0-0x56056].com.ximian.monodevelop[1532]: /Applications/MonoDevelop.app/Contents/MacOS//mono-version-check: line 19: cut: command not found
May 9 21:34:12 Sri-Vishnu-Totakuras-MacBook-Pro [0x0-0x56056].com.ximian.monodevelop[1532]: /Applications/MonoDevelop.app/Contents/MacOS//mono-version-check: line 20: cut: command not found
May 9 21:34:12 Sri-Vishnu-Totakuras-MacBook-Pro [0x0-0x56056].com.ximian.monodevelop[1532]: /Applications/MonoDevelop.app/Contents/MacOS//mono-version-check: line 21: cut: command not found
May 9 21:34:12 Sri-Vishnu-Totakuras-MacBook-Pro [0x0-0x56056].com.ximian.monodevelop[1532]: /Applications/MonoDevelop.app/Contents/MacOS//mono-version-check: line 22: cut: command not found
May 9 21:34:12 Sri-Vishnu-Totakuras-MacBook-Pro [0x0-0x56056].com.ximian.monodevelop[1532]: /Applications/MonoDevelop.app/Contents/MacOS//mono-version-check: line 31: osascript: command not found
May 9 21:34:12 Sri-Vishnu-Totakuras-MacBook-Pro [0x0-0x56056].com.ximian.monodevelop[1532]: Cannot launch MonoDevelop
May 9 21:34:12 Sri-Vishnu-Totakuras-MacBook-Pro [0x0-0x56056].com.ximian.monodevelop[1532]: MonoDevelop requires the Mono Framework version 2.10.4 or later.
May 9 21:34:12 Sri-Vishnu-Totakuras-MacBook-Pro com.apple.launchd.peruser.501[599] ([0x0-0x56056].com.ximian.monodevelop[1532]): Exited with code: 1
I opened the contents of the application and run the shell script for opening aplication there it worked very fine and application started working.. But if i open application directly through launchpad or finder it doesnt show up and console
I tried running those commands in the terminal directly there they work.. But dunno whats wrong in here. and even if try to open the application through the terminal it all opens fine.. what could be the possible problem, is it with my mac..?i finally figured out the problem.. it is with the environmental variables. the path for all those commands like "grep" is not being set for the GUI applications. that is why i got that error.
for those GUI applications which require path, we have to set path in the file /etc/launchd.conf the environmental variables set in here are used by the gui applications and those which are launched through spotlight.
that file may bot be present in most of the macs. No problem even if not present,we can create one and use.
so type in terminal
$ sudo vi /etc/launchd.conf
and in the editor add these lines
setenv PATH = /new/path
and save. Note: replace /new/path with the path which you need to have for the commands used in the script.
remeber that you need to restart your mac for applications to use these environmental variables. -
OS Commands not executing through published java procedure... :(
Hello all :)
Im trying to get a PL/SQL block to delete a file out in the OS. Theres plenty of examples out there and the one I got came from burleson consulting, and incorporates a java method and a call to java wrapped in PL/SQL.. after all suggested grants, using the procedure yields no result. Here is the source code
-- java procedure used to execute OS command
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Host" AS
import java.io.*;
public class Host {
public static void executeCommand(String command) {
try {
String[] finalCommand;
if (isWindows()) {
finalCommand = new String[4];
finalCommand[0] = "C:\\WINDOWS\\system32\\cmd.exe";
finalCommand[1] = "/y";
finalCommand[2] = "/c";
finalCommand[3] = command;
else {
finalCommand = new String[3];
finalCommand[0] = "/bin/sh";
finalCommand[1] = "-c";
finalCommand[2] = command;
final Process pr = Runtime.getRuntime().exec(finalCommand);
new Thread(new Runnable() {
public void run() {
try {
BufferedReader br_in = new BufferedReader(new
InputStreamReader(pr.getInputStream()));
String buff = null;
while ((buff = br_in.readLine()) != null) {
System.out.println(buff);
try {Thread.sleep(100); } catch(Exception e) {}
br_in.close();
catch (IOException ioe) {
System.out.println("Exception caught printing process output.");
ioe.printStackTrace();
}).start();
new Thread(new Runnable() {
public void run() {
try {
BufferedReader br_err = new BufferedReader(new
InputStreamReader(pr.getErrorStream()));
String buff = null;
while ((buff = br_err.readLine()) != null) {
System.out.println(buff);
try {Thread.sleep(100); } catch(Exception e) {}
br_err.close();
catch (IOException ioe) {
System.out.println("Exception caught printing process error.");
ioe.printStackTrace();
}).start();
catch (Exception ex) {
System.out.println(ex.getLocalizedMessage());
public static boolean isWindows() {
if (System.getProperty("os.name").toLowerCase().indexOf("windows") != -1)
return true;
else
return false;
-- PL/SQL wrapper to publish java method.
CREATE OR REPLACE PROCEDURE host_command (p_command IN VARCHAR2)
AS LANGUAGE JAVA
NAME 'Host.executeCommand (java.lang.String)';
these are the grants I am issuing on install:
BEGIN
DBMS_JAVA.grant_permission ('LOANADMIN', 'java.io.FilePermission',
'<>', 'read ,write, execute, delete');
DBMS_JAVA.grant_permission ('LOANADMIN', 'SYS:java.lang.RuntimePermission',
'writeFileDescriptor', '');
DBMS_JAVA.grant_permission ('LOANADMIN', 'SYS:java.lang.RuntimePermission',
'readFileDescriptor', '');
END;
-- and this is the block I am using to execute the OS command..
1 BEGIN
2 host_command (p_command => 'DEL C:\PRETEND.TXT');
3* END;
SQL> /
PL/SQL procedure successfully completed.
Everything returns as successfully completed. But the file is not deleted from the server. I know im missing some kind of privilege. Can anyone help me? Thanks
MoBurleson consulting...
Says it all. Exposure on the Net doesn't mean quality.
Burleson code usually has not been tested, is not robust, and quite often doesn't work.
Why didn't you implement run_cmd, as suggested earlier?
THAT works!
Sybrand Bakker
Senior Oracle DBA -
Delete command are not executed in function of Java Bean
Hello Sir,
In Java bean have a function submitData.I want in this function run delete command through PreparedStatement..But Its not executed.
Please review..
public void submitData()
try
System.out.println("Printed*************************************************************");
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("Loading....");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@VijayKumar-PC:1521:XE","SYSTEM","SYSTEM");
System.out.println("Connection created");
PreparedStatement st=con.prepareStatement("delete from simple where NAME='?' and BNAME='?' ");
String User=getUserName();
st.setString(1,User);
String Bname=getBookName();
st.setString(2,Bname);
int y= st.executeUpdate();
System.out.println(y);
System.out.println("Query Executed");
con.commit();
con.close();
System.out.println("Your Book are Submitted *****************");
catch(Exception e)
e.printStackTrace();
}Thanks.Dear Sir,
I removed the singleaquotes from preparedstatement.But Its not executed in this function.Like:
public void submitData()
try
System.out.println("Printed*************************************************************");
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("Loading....");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@VijayKumar-PC:1521:XE","SYSTEM","SYSTEM");
System.out.println("Connection created");
PreparedStatement st=con.prepareStatement("delete from simple where NAME=? and BNAME=? ");
String User=getUserName();
st.setString(1,User);
String Bname=getBookName();
st.setString(2,Bname);
int y= st.executeUpdate();
System.out.println(y);
System.out.println("Query Executed");
con.commit();
con.close();
System.out.println("Your Book are Submitted *****************");
catch(Exception e)
e.printStackTrace();
}Allthough Insert command is properly executed in another function of Java Bean.
Please review...
Thanks. -
PSFTP mput command not executing.
Hello Guys,
In my below mentioned script, everything is working fine, I'm able to push file on server through put command. But when I'm using mput command to upload multiple files script stucks with no output. I did lot of research but no success. Could anyone of you
can tell me where exact issue is ?
strHostname = "transfer.com"
strUsername = "User1"
strPassword = "password"
strLocalDir = "C:\data"
strRemoteDir = "Sales"
PSFTP_DIR = "c:\windows\"
PSFTP_EXE = PUTTY_DIR & "psftp.exe"
strFile1="*.txt"
'strGetFile ="abc.txt"
strFtpScriptFile = "c:\myscript.txt"
strOutputFile = "C:\output.txt"
Set WshShell=CreateObject("Wscript.Shell")
Set fso=CreateObject("Scripting.FileSystemObject")
Set oFile=fso.OpenTextFile(strFtpScriptFile,2,true)
oFile.WriteLine "lcd " & chr(34) & strLocalDir & chr(34)
oFile.WriteLine "cd " & chr(34) & strRemoteDir & chr(34)
oFile.WriteLine "ls" & chr(34)
'oFile.WriteLine "get " & chr(34) & strGetFile & chr(34)
File.WriteLine "mput " & strFile1
oFile.WriteLine "quit" & chr(34) & vbCrLf
oFile.Close
Set fso = Nothing
PSFTP = "C:\windows\psftp.exe -v -be -bc " & " -l " & strUsername & " -pw " & strPassword & " " & _
strHostname & " -b " & strFtpScriptFile & " >> " & strOutputFile & " 2>&1"
MsgBox PSFTP
WshShell.Run PSFTP,1.True
WScript.Echo oScriptExec.ExitCode
Set oFile = Nothing
'WScript.Echo oScriptExec.StdErr.AtEndOfStream
WScript.Quit
Below is a output when I execute mput command..
Looking up host "transfer.com"
Connecting to <IP ADDRESS> port 22
Server version: SSH-2.0-Internet Server SSHD
Using SSH protocol version 2
We claim version: SSH-2.0-PuTTY_Release_0.63
Doing Diffie-Hellman group exchange
Doing Diffie-Hellman key exchange with hash SHA-1
Host key fingerprint is:
ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx
Initialised AES-256 SDCTR client->server encryption
Initialised HMAC-SHA1 client->server MAC algorithm
Initialised AES-256 SDCTR server->client encryption
Initialised HMAC-SHA1 server->client MAC algorithm
Using username "User1".
This is MFT KIILA QA env DMZ ServerAttempting keyboard-interactive authentication
Access granted
Opening session as main channel
Opened main channel
Started a shell/command
PTmput command worked perfectly. As there was no indication of file uploading progress in %, I assumed script stucked in mid.
Apart from question I asked I have few queries:
1. As my log states above "Server version: SSH-2.0-Internet Server SSHD". I'm in need of codes list returned by
server.
2. Can it be possible to get file transfer rate means progress in %?
3. Currently Which file is in use (means uploading). How can it be tracked?
PT -
Unusual 550 5.7.1 Command Not Allowed being sent from Exchange 2010
Greetings,
I have an Exchange 2010 server that seems to be rejecting some emails from external domains with 550 5.7.1 Command Not Allowed. I've taken a look at the SMTP Receive logs (below) and can't seem to find any reason why the emails are getting rejected. The sequence
immediately prior to the 550 being sent is highlighted in bold.
#Fields: date-time sequence-number local-endpoint remote-endpoint event data context
2014-11-05T08:42:27.545Z 0 192.168.3.5:25 212.82.97.117:53913 +
2014-11-05T08:42:27.545Z 1 192.168.3.5:25 212.82.97.117:53913 * SMTPSubmit SMTPAcceptAnySender SMTPAcceptAuthoritativeDomainSender AcceptRoutingHeaders Set Session Permissions
2014-11-05T08:42:27.545Z 2 192.168.3.5:25 212.82.97.117:53913 > 220 SERVER.domain.com Microsoft ESMTP MAIL Service ready at Wed, 5 Nov 2014 03:42:27 -0500
2014-11-05T08:42:27.657Z 3 192.168.3.5:25 212.82.97.117:53913 < EHLO nm34-vm3.bullet.mail.ir2.yahoo.com
2014-11-05T08:42:27.658Z 4 192.168.3.5:25 212.82.97.117:53913 > 250-SERVER.domain.com Hello [212.82.97.117]
2014-11-05T08:42:27.658Z 5 192.168.3.5:25 212.82.97.117:53913 > 250-SIZE
2014-11-05T08:42:27.658Z 6 192.168.3.5:25 212.82.97.117:53913 > 250-PIPELINING
2014-11-05T08:42:27.658Z 7 192.168.3.5:25 212.82.97.117:53913 > 250-DSN
2014-11-05T08:42:27.658Z 8 192.168.3.5:25 212.82.97.117:53913 > 250-ENHANCEDSTATUSCODES
2014-11-05T08:42:27.658Z 9 192.168.3.5:25 212.82.97.117:53913 > 250-STARTTLS
2014-11-05T08:42:27.658Z 10 192.168.3.5:25 212.82.97.117:53913 > 250-X-ANONYMOUSTLS
2014-11-05T08:42:27.658Z 11 192.168.3.5:25 212.82.97.117:53913 > 250-AUTH NTLM
2014-11-05T08:42:27.658Z 12 192.168.3.5:25 212.82.97.117:53913 > 250-X-EXPS GSSAPI NTLM
2014-11-05T08:42:27.658Z 13 192.168.3.5:25 212.82.97.117:53913 > 250-8BITMIME
2014-11-05T08:42:27.658Z 14 192.168.3.5:25 212.82.97.117:53913 > 250-BINARYMIME
2014-11-05T08:42:27.658Z 15 192.168.3.5:25 212.82.97.117:53913 > 250-CHUNKING
2014-11-05T08:42:27.658Z 16 192.168.3.5:25 212.82.97.117:53913 > 250-XEXCH50
2014-11-05T08:42:27.658Z 17 192.168.3.5:25 212.82.97.117:53913 > 250-XRDST
2014-11-05T08:42:27.658Z 18 192.168.3.5:25 212.82.97.117:53913 > 250 XSHADOW
2014-11-05T08:42:27.756Z 19 192.168.3.5:25 212.82.97.117:53913 < STARTTLS
2014-11-05T08:42:27.756Z 20 192.168.3.5:25 212.82.97.117:53913 > 220 2.0.0 SMTP server ready
2014-11-05T08:42:27.756Z 21 192.168.3.5:25 212.82.97.117:53913 * Sending certificate
2014-11-05T08:42:27.756Z 22 192.168.3.5:25 212.82.97.117:53913 * CN=SERVER Certificate subject
2014-11-05T08:42:27.756Z 23 192.168.3.5:25 212.82.97.117:53913 * CN=SERVER Certificate issuer name
2014-11-05T08:42:27.756Z 24 192.168.3.5:25 212.82.97.117:53913 * 3BF7DF215EB42FB14FAE1BF7E4369E06 Certificate serial number
2014-11-05T08:42:27.756Z 25 192.168.3.5:25 212.82.97.117:53913 * 01494AD746353CCE0F198CE83AD4D6A8592C29F5 Certificate thumbprint
2014-11-05T08:42:27.756Z 26 192.168.3.5:25 212.82.97.117:53913 * SERVER;SERVER.domain.com Certificate alternate names
2014-11-05T08:42:28.059Z 27 192.168.3.5:25 212.82.97.117:53913 < EHLO nm34-vm3.bullet.mail.ir2.yahoo.com
2014-11-05T08:42:28.059Z 28 192.168.3.5:25 212.82.97.117:53913 * TlsDomainCapabilities='None'; Status='NoRemoteCertificate'
2014-11-05T08:42:28.060Z 29 192.168.3.5:25 212.82.97.117:53913 > 250-SERVER.domain.com Hello [212.82.97.117]
2014-11-05T08:42:28.060Z 30 192.168.3.5:25 212.82.97.117:53913 > 250-SIZE
2014-11-05T08:42:28.060Z 31 192.168.3.5:25 212.82.97.117:53913 > 250-PIPELINING
2014-11-05T08:42:28.060Z 32 192.168.3.5:25 212.82.97.117:53913 > 250-DSN
2014-11-05T08:42:28.060Z 33 192.168.3.5:25 212.82.97.117:53913 > 250-ENHANCEDSTATUSCODES
2014-11-05T08:42:28.060Z 34 192.168.3.5:25 212.82.97.117:53913 > 250-AUTH NTLM LOGIN
2014-11-05T08:42:28.060Z 35 192.168.3.5:25 212.82.97.117:53913 > 250-X-EXPS GSSAPI NTLM
2014-11-05T08:42:28.060Z 36 192.168.3.5:25 212.82.97.117:53913 > 250-8BITMIME
2014-11-05T08:42:28.060Z 37 192.168.3.5:25 212.82.97.117:53913 > 250-BINARYMIME
2014-11-05T08:42:28.060Z 38 192.168.3.5:25 212.82.97.117:53913 > 250-CHUNKING
2014-11-05T08:42:28.060Z 39 192.168.3.5:25 212.82.97.117:53913 > 250-XEXCH50
2014-11-05T08:42:28.060Z 40 192.168.3.5:25 212.82.97.117:53913 > 250-XRDST
2014-11-05T08:42:28.060Z 41 192.168.3.5:25 212.82.97.117:53913 > 250 XSHADOW
2014-11-05T08:42:28.158Z 42 192.168.3.5:25 212.82.97.117:53913 < MAIL FROM:<[email protected]>
2014-11-05T08:42:28.158Z 43 192.168.3.5:25 212.82.97.117:53913 * 08D11121D08C9A95;2014-11-05T08:42:27.545Z;1 receiving message
2014-11-05T08:42:28.159Z 44 192.168.3.5:25 212.82.97.117:53913 > 250 2.1.0 Sender OK
2014-11-05T08:42:28.364Z 45 192.168.3.5:25 212.82.97.117:53913 < RCPT TO:<[email protected]>
2014-11-05T08:42:28.364Z 46 192.168.3.5:25 212.82.97.117:53913 > 250 2.1.5 Recipient OK
2014-11-05T08:42:28.462Z 47 192.168.3.5:25 212.82.97.117:53913 < DATA
2014-11-05T08:42:29.275Z 48 192.168.3.5:25 212.82.97.117:53913 * Tarpit for '0.00:00:05'
2014-11-05T08:42:34.278Z 49 192.168.3.5:25 212.82.97.117:53913 > 550 5.7.1 Command not allowed
2014-11-05T08:42:34.521Z 50 192.168.3.5:25 212.82.97.117:53913 < RSET
2014-11-05T08:42:34.521Z 51 192.168.3.5:25 212.82.97.117:53913 * Tarpit for '0.00:00:05'
2014-11-05T08:42:39.523Z 52 192.168.3.5:25 212.82.97.117:53913 > 250 2.0.0 Resetting
2014-11-05T08:42:39.621Z 53 192.168.3.5:25 212.82.97.117:53913 < MAIL FROM:<[email protected]>
2014-11-05T08:42:39.621Z 54 192.168.3.5:25 212.82.97.117:53913 * 08D11121D08C9A95;2014-11-05T08:42:27.545Z;2 receiving message
2014-11-05T08:42:39.621Z 55 192.168.3.5:25 212.82.97.117:53913 > 250 2.1.0 Sender OK
2014-11-05T08:42:39.719Z 56 192.168.3.5:25 212.82.97.117:53913 < RCPT TO:<[email protected]>
2014-11-05T08:42:39.719Z 57 192.168.3.5:25 212.82.97.117:53913 > 250 2.1.5 Recipient OK
2014-11-05T08:42:39.817Z 58 192.168.3.5:25 212.82.97.117:53913 < DATA
2014-11-05T08:42:39.838Z 59 192.168.3.5:25 212.82.97.117:53913 * Tarpit for '0.00:00:05'
2014-11-05T08:42:44.837Z 60 192.168.3.5:25 212.82.97.117:53913 > 550 5.7.1 Command not allowed
2014-11-05T08:42:45.078Z 61 192.168.3.5:25 212.82.97.117:53913 < RSET
2014-11-05T08:42:45.078Z 62 192.168.3.5:25 212.82.97.117:53913 * Tarpit for '0.00:00:05'
2014-11-05T08:42:50.079Z 63 192.168.3.5:25 212.82.97.117:53913 > 250 2.0.0 Resetting
2014-11-05T08:42:50.177Z 64 192.168.3.5:25 212.82.97.117:53913 < QUIT
2014-11-05T08:42:50.177Z 65 192.168.3.5:25 212.82.97.117:53913 > 221 2.0.0 Service closing transmission channel
2014-11-05T08:42:50.177Z 66 192.168.3.5:25 212.82.97.117:53913 - Local
I have another entry in my logs fro the same sender coming from the same IP which yields the same results. Strangely enough, there are other entries from the same sender coming from different IPs which are delivered just fine.
The sender has stated that they only get the rejects when replying to emails from my domain, not when he sends fresh emails.
Why would Exchange send the 550 5.7.1 in response to a DATA command when it responds with 354 Start mail input; end with <CRLF>.<CRLF> to other DATA commands from a different server?
Bit of an odd problem, any help would be greatly appreciated.
Thanks,
B. ColtThanks for the input Mr. Crowley. I've dumped the Receive Connector configurations, everything seems to be at default values except for logging (I set it to verbose).
RunspaceId : 17f0dc01-c2a9-45ce-812d-5d47688b6650
AuthMechanism : Tls, BasicAuth, BasicAuthRequireTLS
Banner :
BinaryMimeEnabled : True
Bindings : {12.34.56.78:25}
ChunkingEnabled : True
DefaultDomain :
DeliveryStatusNotificationEnabled : True
EightBitMimeEnabled : True
BareLinefeedRejectionEnabled : False
DomainSecureEnabled : False
EnhancedStatusCodesEnabled : True
LongAddressesEnabled : False
OrarEnabled : False
SuppressXAnonymousTls : False
AdvertiseClientSettings : False
Fqdn : mail.MYDOMAIN.com
Comment :
Enabled : True
ConnectionTimeout : 00:10:00
ConnectionInactivityTimeout : 00:05:00
MessageRateLimit : unlimited
MessageRateSource : IPAddress
MaxInboundConnection : 5000
MaxInboundConnectionPerSource : 20
MaxInboundConnectionPercentagePerSource : 2
MaxHeaderSize : 64 KB (65,536 bytes)
MaxHopCount : 60
MaxLocalHopCount : 12
MaxLogonFailures : 3
MaxMessageSize : 100 MB (104,857,600 bytes)
MaxProtocolErrors : 5
MaxRecipientsPerMessage : 200
PermissionGroups : ExchangeUsers, ExchangeServers
PipeliningEnabled : True
ProtocolLoggingLevel : Verbose
RemoteIPRanges : {0.0.0.0-255.255.255.255}
RequireEHLODomain : False
RequireTLS : False
EnableAuthGSSAPI : False
ExtendedProtectionPolicy : None
LiveCredentialEnabled : False
TlsDomainCapabilities : {}
Server : MYSERVER
SizeEnabled : Enabled
TarpitInterval : 00:00:05
MaxAcknowledgementDelay : 00:00:30
AdminDisplayName :
ExchangeVersion : 0.1 (8.0.535.0)
Name : default MYDOMAIN.com
DistinguishedName : CN=default MYDOMAIN.COM,CN=SMTP Receive Connectors,CN=Protocols,CN=MYSERVER,CN=Servers,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=My
Company,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=DOMAIN
,DC=local
Identity : SERVER\default MYDOMAIN.COM
Guid : 04d418d8-06f6-4e13-8f3b-439f9c6509b0
ObjectCategory : MYDOMAIN.COM/Configuration/Schema/ms-Exch-Smtp-Receive-Connector
ObjectClass : {top, msExchSmtpReceiveConnector}
WhenChanged : 10/1/2014 3:53:53 PM
WhenCreated : 3/1/2012 2:33:10 PM
WhenChangedUTC : 10/1/2014 7:53:53 PM
WhenCreatedUTC : 3/1/2012 7:33:10 PM
OrganizationId :
OriginatingServer : SERVER.MYDOMAIN.COM
IsValid : True
RunspaceId : 17f0dc01-c2a9-45ce-812d-5d47688b6650
AuthMechanism : Tls, Integrated, BasicAuth, BasicAuthRequireTLS, ExchangeServer
Banner :
BinaryMimeEnabled : True
Bindings : {:::25, 0.0.0.0:25}
ChunkingEnabled : True
DefaultDomain :
DeliveryStatusNotificationEnabled : True
EightBitMimeEnabled : True
BareLinefeedRejectionEnabled : False
DomainSecureEnabled : False
EnhancedStatusCodesEnabled : True
LongAddressesEnabled : False
OrarEnabled : False
SuppressXAnonymousTls : False
AdvertiseClientSettings : False
Fqdn : SERVER.MYDOMAIN.COM
Comment :
Enabled : True
ConnectionTimeout : 00:10:00
ConnectionInactivityTimeout : 00:05:00
MessageRateLimit : unlimited
MessageRateSource : IPAddress
MaxInboundConnection : 5000
MaxInboundConnectionPerSource : unlimited
MaxInboundConnectionPercentagePerSource : 100
MaxHeaderSize : 64 KB (65,536 bytes)
MaxHopCount : 60
MaxLocalHopCount : 12
MaxLogonFailures : 3
MaxMessageSize : 100 MB (104,857,600 bytes)
MaxProtocolErrors : 5
MaxRecipientsPerMessage : 5000
PermissionGroups : AnonymousUsers, ExchangeUsers, ExchangeServers, ExchangeLegacyServers
PipeliningEnabled : True
ProtocolLoggingLevel : Verbose
RemoteIPRanges : {192.168.1.0(255.255.255.0), ::-ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff, 0.0.0.0-255.255.255.255}
RequireEHLODomain : False
RequireTLS : False
EnableAuthGSSAPI : False
ExtendedProtectionPolicy : None
LiveCredentialEnabled : False
TlsDomainCapabilities : {}
Server : MYSERVER
SizeEnabled : EnabledWithoutValue
TarpitInterval : 00:00:05
MaxAcknowledgementDelay : 00:00:30
AdminDisplayName :
ExchangeVersion : 0.1 (8.0.535.0)
Name : Default SERVER
DistinguishedName : CN=Default SERVER,CN=SMTP Receive Connectors,CN=Protocols,CN=SERVER,CN=Servers,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=MY
COMPANY,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=MYDOMAIN,DC=l
ocal
Identity : SERVER\Default SERVER
Guid : fc6ab381-1cf9-4edb-bec4-3a2c092cd4e3
ObjectCategory : mydomain/Configuration/Schema/ms-Exch-Smtp-Receive-Connector
ObjectClass : {top, msExchSmtpReceiveConnector}
WhenChanged : 10/1/2014 3:56:23 PM
WhenCreated : 2/6/2012 11:51:58 AM
WhenChangedUTC : 10/1/2014 7:56:23 PM
WhenCreatedUTC : 2/6/2012 4:51:58 PM
OrganizationId :
OriginatingServer : SERVER.mydomain.com
IsValid : True
I really don't want to turn off the tarpitting and expose myself to tons of spam, although I do have anti-spam filters running.
Any thoughts?
Thanks again,
B. Colt
Brian Colt -
Executing system commands like cd on Linux from Java Code
Hi,
I need to execute a few system commands (like cd, ls, tar, etc.,) on RedHat Linux 7.1 from Java code. Any ideas plz.
best wishes,
IssacSince this thread mentioned using the DOS START command
from an exec(), I was wondering whether anyone else is
seeing the odd behavior I am.
Most of the examples showing how to read stdout and stderr
while the process is running show simple loops that use
getInputStream and getErrorStream and do read's until they
get back -1. Most of these examples are insensitive to the
state of the Process.waitFor that happens elsewhere and sort
of rely on the -1 and the waitFor happening roughly together.
Whenever I use this technique to launch an arbitrary DOS
command (e.g. Runtime.exec("dir")), it works fine, and
everything seems to terminate as expected.
However, when my command is something like:
Runtime.exec("cmd /c start my.bat")
where I deliberately use the START command to fork off
a different process, something odd happens.
Those simple read loops get an initial burst of stdout/stderr
bytes from the "start" part of the command. But then eventually,
these loops do a "read" which blocks on those InputStreams. Now,
even if my Process.waitFor returns (because the start returned
immediately), those read loops stay blocked **until that script
started by 'start' runs to completion**. It is like the child
of the child is holding those streams open somehow.
I found that by doing something like an InputStream.available() or
a BufferedReader.ready( ) check before dropping into the read,
and allowing the Process.waitFor completion to exit those read loops,
them I get what I expect -- namely immediate return from the START,
but apparently complete copies of stdout and stderr.
Curiously, in the case where the reads block until the child process
started by START terminates, they still don't get the child's/child's
stdout and stderr. It is just a long duration thread block that
yields no data.
Can anyone explain what is happening to a
Process.getInputStream( ).read()
when the process immediately does a START and returns? Why would
the read( ) stay blocked when the START finished launching a new child
process?
... ron cain -
Jar command not execute !
Hello!
I have jdk6u35 (64-bit) alongwith Weblogic1036 and 11gr2 Forms/Reports (64-bit).
When I give following command to make a jar file for icons;
jar -cvf frmicons.jar *.gif
It doesn't execute, as it is not recognised as an internal command or external command.
Guide me please.
Thanks with Regards.
Bhatt.
Edited by: 982164 on Mar 31, 2013 1:38 PMHi Bhatt,
You need to add your java to your path.
I think you are using windows so just add the path to bin folder from java to PATH variable and you will be able to execute the command.
For example if you have java installed in C:\Program Files\Java\jdk1.6.0_37 just add the following to PATH environment variable at the beginning:
C:\Program Files\Java\jdk1.6.0_37\bin; You may follow this guide:
http://www.kingluddite.com/tools/how-do-i-add-java-to-my-windows-path
Hope this helps you :)
Regards
Carlos
Maybe you are looking for
-
How to preserve and keep 2 Pantones from Illustrator, via Photoshop, to InDesign?
Ciao! I have designed a 3D illustration in Illustrator (version 15.0.2), this illustration need to be printed for a magazine cover and I want to use 2 pantone colours for it. The 2 pantone colours are assigned form the Swatch Palette. The image is in
-
[JS] [CS5] Possible to change "Paragraph Spacing Limit" with a Script
Hi, right now I'm writing a simple script which formats some text. For this formatting I need the vertical Justification "Justify" with a "Paragraph Spacing Limit" but I can't find something helpful. Does anyone know how to set the limit to a specifi
-
Finder Error -36 When Transferring MP3s from One External HD to Another
I am trying to transfer MP3 files from a Lacie external HD to a Western Digital external HD. Initially some files transferred without any problem but then I started to get this error message: The Finder can't complete the operation because some data
-
How can I delate sync photos from my ipad?
How can I delate sync photos from my ipad?
-
Best practices for WC State, Code, Attribute
Currently, our process for assigning WC Codes is to assign them at the position level once an ee is joined to the position. The result is a lot of one-off efforts outside of our regular workflow. Is it possible to assign these attributes at the job