Linux command in HOST
Hi all,
I'm trying to run a file from oracle form version 9 using the below statement:
HOST('sh /foldera/compile/fmx/ftp.sh');
and it seems like not working. My AS in linux.
I successfully run 'sh /foldera/compile/fmx/ftp.sh' in my linux terminal.
I guess my HOST statement is incorrect.
Any idea?
Thanks
1 make sure u use the same operating user when u ran the command succesfully.
2 From the webform, try doing a simple script which copy files on the IAS.
If it works fine then the issue is with FTP.
3 If step 2 doesnt work issue is with user account/unable to find the shell script/shell
Rajesh Alex
Similar Messages
-
Dear All,
I was trying to use ed command to open an editor to update my sql statements on Linux. Please can anyone tell me how I can implement it in Linux command prompt.
Thanks in advance,
Ash$ ed /etc/hosts
632
5
192.168.1.45 srv001 loghost
s/g/cal
192.168.1.45 srv001 localhost
w hosts
634
q
$ ed at command prompt just works fine. What's your issue? And how is it related to sqlplus?
Do you want to default it to vi?
$ sqlplus /
SQL> def _editor=vi(vi is an editor available on Unix. On Linux, you can get the source on http://ex-vi.sourceforge.net . If you are really lazy you can use the vi clone your linux distribution provides)
If you want to change the default, check for solutions with login.sql/glogin.sql in the doc/forum -
Create .txt empty file After Message Processing Command Line Linux command
Hi All,
An empty .txt file has to be created in FTP location(FTP loc c:\xyz\Customer20082910.txt) only after the .dat file has been created(FTP loc c:\xyz\Customer20082910.dat)
Note:.dat has the actual data and .txt is an empty file and is created only after .dat is created
I know that .txt empty file can be created using the After Message Processing Command Line...
But confused which command to be given such that it will be created in the FTP location(c:\xyz\Customer20082910.txt)
Can any one please give the Linux command for it...
Regards,
SridharHi Aamir,
Thanks for the suggestion, I will ask my client to create a shell script at FTP server...
And one more question,
This is reverse side , now the .dat file is to be picked only if .txt exists at the FTP server (scenario File > XI>SAP) (earlier was SAP>XI>File)..
So please can you suggest for this also...
How can i check for the .txt and pick corresponding .dat file...
i had posted question long back
Need to pick .TXT file only if .CTL file is available
Regards,
Sridhar -
Working Linux command to grep date range in a log file
Linux Gurus,
Could you please help me with command to show only those lines in a log file which falls under some date range, probably using grep command.
Our server logs are in following format <Jun 23, 2013 12:45:02 AM UTC>
Regards,
VarunPerhaps you can do the following:
Go to Google.
Type "working Linux command to grep date range in a log file"
See what results you might get from that search. ( I did, and got more than 600,000 search results.) -
Problem in executing Linux command from Java Programme.
hi everybody,
can anybody help me to solve one problem i have.
i want to capture the output of linux command "grep" in my java programme.but it is not working properly .(maybe this sub-process doesn't have permission to read files)
here is my code and corresponding outputs.
import java.io.*;
public class BSearch
public static void main(String kj[])
try
Runtime rt=Runtime.getRuntime();
String command="grep \"hello\" -r /usr/MyDir ";
Process rtProc=rt.exec(command);
InputStream is=rtProc.getInputStream();
BufferedReader br =new BufferedReader(new InputStreamReader(is));
String line =null;
while((line=br.readLine()) != null)
System.out.println(br.readLine());
br.close();
catch(Exception e)
System.err.println("Error in command "+e);
it finds "hello" pattern only in BSearch.class file although if i fire this command on LINUX prompt it
shows all the files in /usr/MyDir which contain "hello" pattern.
java programme output :
Binary file /usr/MyDir/BSearch.class matches.
linux command output :
/usr/MyDir/one.txt: hello sdfs
Binary file /usr/MyDir/BSearch.class matches.
/usr/MyDir/two.txt: kjsdf hello sdfsdf
will anybody help me solve this problem.It may be a Problem of Catching the Echoes back from the Processes...I have a Program which Captures the Echoes..see if it works
import java.beans.PropertyChangeEvent;import java.beans.PropertyChangeListener;import java.beans.PropertyChangeSupport;import java.lang.ref.WeakReference;/** * Implements a proxy property change listener using a weak reference to avoid memory locking that would occur if it * was a strong reference. To understand this, we hve to understand that the property change listeners themselves are * hilding onto panels and other objects with strong java references. If the panel goes away while we are viewing an * object, we have a circular emory hold situation where the panel cant be collected because it has ahold of the * property and the property cannot because it has ahold of the pane. If we use weak references instead, then the hard * link between the listener and the producer is softened to almost nothing. */public class WeakPropertyChangeListener implements PropertyChangeListener { /** * A poperty change support object is included here so that the listener can remove * himself from the listeners if the reference internally goes to null. */ private PropertyChangeSupport pcs = null; /** Holds the weak reference to the real listener. */ private WeakReference weakRef = null; /** * Constructs a new Proxy object for the given support and listener. * @param pcs The property change support that this object will be using. * @param pcl The real listener. */ public WeakPropertyChangeListener(PropertyChangeSupport pcs, PropertyChangeListener pcl) { if (pcs == null) throw new NullPointerException("pcs"); if (pcl == null) throw new NullPointerException("pcl"); this.pcs = pcs; weakRef = new WeakReference(pcl); } /** @see <{PropertyChangeListener}> */ public void propertyChange(PropertyChangeEvent changeEvent) { Object referrant = weakRef.get(); if (referrant == null) { pcs.removePropertyChangeListener(this); } else { ((PropertyChangeListener)referrant).propertyChange(changeEvent); } } /** Returns true for comparison to referrant or this. */ public boolean equals(Object obj) { if (obj instanceof WeakPropertyChangeListener) return super.equals(obj); else if (obj != null)return obj.equals(weakRef.get()); else return false; }}// snipet public void addPropertyChangeListener(PropertyChangeListener listener) { this.propertyChangeSupport.addPropertyChangeListener( new WeakPropertyChangeListener(this.propertyChangeSupport, listener)); } public void removePropertyChangeListener(PropertyChangeListener listener) { this.propertyChangeSupport.removePropertyChangeListener(listener); } -
How to call linux command ?
hi all,
I wanna make java application which display the ouput of linux command (eg. ps -ax output in JTextArea).
The problem is how to call "ps,kill,etc" ?JTextArea txtOutput = new JTextArea();
String cmd = "ps -a";
Process proc = Runtime.getRuntime().exec(cmd);
BufferedReader buf = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String out;
while ((out = buf.readLine()) != null){
System.out.println("Output: "+out);
txtOutput.append(out+"\n");
} -
How to execute Linux command from Java app.
Hi all,
Could anyone show me how to execute Linux command from Java app. For example, I have the need to execute the "ls" command from my Java app (which is running on the Linux machine), how should I write the codes?
Thanks a lot,You can use "built-in" shell commands, you just need to invoke the shell and tell it to run the command. See the -c switch in the man page for your shell. But, "ls" isn't built-in anyays.
If you use exec, you will want to set the directory with the dir argument to exec, or add it to the command or cmdarray. See the API for the variants of java.lang.Runtime.exec(). (If you're invoking it repeatedly, you can most likely modify a cmdarray more efficiently than having exec() decompose your command).
You will also definitely want to save the returned Process and read the output from it (possibly stderr too and get an exit status). See API for java.lang.Process. Here's an example
java.io.BufferedReader br =
new java.io.BufferedReader(new java.io.InputStreamReader(
Runtime.getRuntime().exec ("/sbin/ifconfig ppp0").
getInputStream()));
while ((s = br.readLine()) != null) {... -
Execute linux command from java
I wanna execute linux command from java, bu the output has error:
Return code = 1
top: failed tty get
The code as:
import java.io.*;
public class Execute {
public static void main(String[] args) {
try {
final Process process = Runtime.getRuntime().exec("top");
new Thread() {
public void run() {
try {
InputStream is = process.getInputStream();
byte[] buffer = new byte[1024];
for (int count = 0; (count = is.read(buffer)) >= 0;) {
System.out.write(buffer, 0, count);
} catch (Exception e) {
e.printStackTrace();
}.start();
new Thread() {
public void run() {
try {
InputStream is = process.getErrorStream();
byte[] buffer = new byte[1024];
for (int count = 0; (count = is.read(buffer)) >= 0;) {
System.err.write(buffer, 0, count);
} catch (Exception e) {
e.printStackTrace();
}.start();
int returnCode = process.waitFor();
System.out.println("Return code = " + returnCode);
} catch (Exception e) {
e.printStackTrace();
}Help please.Your code is probably good to run a program, that does not use terminal capabilities.
Program "top" is a little bit more complicated - you have to run it with a real terminal.
Try to run "xterm -e top". You can find an example how to run an external program
from java code in cnd/gdb module on http://cnd.netbeans.org
For example, take a look at openExternalProgramIOWindow() method on this page:
http://cnd.netbeans.org/source/browse/cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/proxy/Attic/GdbProxyCL.java?rev=1.1.2.6.2.5&only_with_tag=release551_fixes&view=markup
It runs a command with external terminal.
Thanks,
Nik -
Unable to execute Linux command from Java
Hi,
I am currently working on a code wherein i need to execute Linux command from Java. Below are some of the query i have.
1) Is there any efficient method of running OS commands from Java, rather than using Runtime and Process method.
2) Below is details of my code which fails in execution
**-- Java Version**
java version "1.6.0"
OpenJDK Runtime Environment (build 1.6.0-b09)
OpenJDK Server VM (build 1.6.0-b09, mixed mode)
-- Program Code ----
Where <path> = Path i put myself
package test;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.*;
public class GetInode{
* @param args
public static void main(String[] args) {
GetInode test = new GetInode();
test.getInode();
public void getInode(){
String command = "/usr/bin/stat -Lt <path>;
System.out.println(command);
Process process;
Runtime rt;
try{
rt = Runtime.getRuntime();
process = rt.exec(command);
InputStreamReader isr = new InputStreamReader(process.getErrorStream());
BufferedReader bre = new BufferedReader(isr);
BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream());
System.out.println(bre.readLine());
System.out.println(br.readLine().split(" ")[7]);
process.destroy();
}catch (Exception ex){
System.out.println("Error :- " + ex.getMessage());
------Output -------------
/usr/bin/stat -Lt "<path>"
/usr/bin/stat: cannot stat `"<path>"': No such file or directory
Error :- null
Can any one help me what is wrong and why i am unable to run the Linux command from Java.For clarity purpose............i m submitting actual code here
--- Code ---
package test;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.*;
public class GetInode{
* @param args
public static void main(String[] args) {
GetInode test = new GetInode();
test.getInode();
public void getInode(){
String command = "/usr/bin/stat -Lt \"/afs/inf.ed.ac.uk/user/s08/s0898671/workspace/CASWESBLIN/TestFS/01_FIL_01.txt.txt\"";
System.out.println(command);
Process process;
Runtime rt;
try{
rt = Runtime.getRuntime();
process = rt.exec(command);
InputStreamReader isr = new InputStreamReader(process.getErrorStream());
BufferedReader bre = new BufferedReader(isr);
BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
System.out.println(bre.readLine());
System.out.println(br.readLine().split(" ")[7]);
process.destroy();
}catch (Exception ex){
System.out.println("Error :- " + ex.getMessage());
--- Output ---
[ratz]s0898671: java GetInode
/usr/bin/stat -Lt "/afs/inf.ed.ac.uk/user/s08/s0898671/workspace/CASWESBLIN/TestFS/01_FIL_01.txt.txt"
/usr/bin/stat: cannot stat `"/afs/inf.ed.ac.uk/user/s08/s0898671/workspace/CASWESBLIN/TestFS/01_FIL_01.txt.txt"': No such file or directory
Error :- null
-- Linux Terminal --
If i copy the first line from the output and execute on Linux terminal her is the output that i get
[ratz]s0898671: /usr/bin/stat -Lt "/afs/inf.ed.ac.uk/user/s08/s0898671/workspace/CASWESBLIN/TestFS/01_FIL_01.txt.txt"
/afs/inf.ed.ac.uk/user/s08/s0898671/workspace/CASWESBLIN/TestFS/01_FIL_01.txt.txt 12003 24 81a4 453166 10000 1c 360466554 2 0 1 1246638450 1246638450 1246638450 4096
Can you just assist me where am i really making mistake.......i was wondering if the command that i pass from Java....can be executed on Linux terminal why is it faling to run from java.........and when i print the Error Stream for process output........it show cannot Stat....... -
Problem in running Linux command using JavaRuntine
All,
When I ran a Linux command in Java Program It does not give a correct output instead it returns null string.
When I ran the Qsub command( as given in the below program) in Java program I suppose to get Unable to run job: unknown resource "mechhpc1".Exiting. as an output. But it returns null string. It works fine in linux terminal.
Can you please anyone help me to fix this issue?
Regards,
Thamizhannal P
Source code:
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class QSubCmdTest {
static String Qsub = "sudo -u tce qsub -S /bin/bash ansys_p3 "
+ "-pe Parallel 3 -l h_rt=3:4:4,ansys=0.333,mechhpc1=0.333 "
+ "-a 0804081247.15 /home/tce/c1p4/AnsysParallel";
/* The aboove command output in terminal (linux machine)
Unable to run job: unknown resource "mechhpc1".Exiting. */
static String QSUBcommandOutput = "";
public static void main(String[] args) {
System.out.println("Job Submission testing");
try {
Process processExecGenericJobScript = Runtime.getRuntime().exec( new String[]{"/bin/bash","-c",Qsub});
//QSUB Command output Reader
BufferedReader QSUBcommandOutputReader = new BufferedReader(
new InputStreamReader(processExecGenericJobScript
.getInputStream()));
System.out.println("Reader "+QSUBcommandOutputReader.readLine());
//QSUB command output string
String QSUBCommandOutputString = "";
while ((QSUBCommandOutputString = QSUBcommandOutputReader
.readLine()) != null) {
QSUBcommandOutput += QSUBCommandOutputString;
QSUBcommandOutput += "\n";
System.out.println("QSUBcommandOutput:" + QSUBcommandOutput);
} catch (Exception exp) {
exp.getMessage();
}I would expect error messages to be output on stderr not stdout and you only read stdout. You should read, digest and implement the recommendations in http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html .
-
Linux commands to check box configuration
What are the linux commands to chekc the configuration of box, like memory, disk, OS etc
You should most find of them here: http://download-uk.oracle.com/docs/html/A97297_01/ch2_tun.htm#i17100
Message was edited by:
Pierre Forstmann -
Business Catalyst: Linux or Apache hosting environment?
Is Business Catalyst running on a Linux or Apache hosting environment?
Neither,
It is Microsoft .Net environment and SQL.
IF you asking in relation to doing server side code on the platform - You can not do so. ITs closed off. (SAAS) -
New wiki: Solaris-Linux command comparison
Ever have trouble remembering command syntax in Solaris or Linux? Like the precise syntax for how to list the 10 largest files, create an ISO image, or manage printers? Can you remember the syntax in Linux but need the equivalent in Solaris? Or vice versa?
A new wiki -- "OTN Solaris-Linux Command Comparo" -- lists common sysadmin tasks for both Oracle Solaris 10 & Oracle Enterprise Linux 5. You can access the wiki at:
[https://wikis.sun.com/display/OTNTaskFinder/CommandComparo+Home|https://wikis.sun.com/display/OTNTaskFinder/CommandComparo+Home]
Note that you need to register for Oracle Wiki site access first at [http://wikis.sun.com/display/Help/Registering|http://wikis.sun.com/display/Help/Registering] . Please give us some feedback on the wiki and add the commands you most often forget...Yes, we wanted to go a little more in-depth and list actual syntax, but the idea is the same. You'll note that "A Sysadmin's Unixersal Translator (ROSETTA STONE)" is listed as a Reference in the .left-section panel of the wiki.
-
Executing a linux command through flash lite
Hello All,
i want to know one thing.. : is it possible to execute a linux command through flash lite?
I mean, say, in linux at the command prompt if i want to change the date and time then i will execute command date 082110452009.00 to set
21 August 2009, 11:45:00 .. i want to do this through actionscript2.. first i wil provide a UI asking the user to set date, time, year.. once he clicks OK i want to execute the above command with the user input..
This is because currently i m running this application on an embedded linux device which doesn't have a real time clock.. i mean once i switch off and ON the device the date and time will set back to default value 01 Jan 1970 as it happens in linux..
any suggestions?get the the inputStream of the runtime object after executing the command.
now use the readLine() function until it becomes null.
egs: with reference to ur code.
InputStream is=p.getInputStream()
while(is!=null)
String s=is.readLine();
if the command don't execute try giving the full path also like /sbin/ls -l -
How can I execute Linux commands through a JSP page on a Red Hat Linux 6.1 Machine using Tomcat 3.0
Please Mail your answer
[email protected]Hi Nick,
Thankx a lot, for suggestion,
I wanted to make a page which gives me a text box to write a command and below it shows the result of that command,
Say , I m in directory "/home/dhiraj"
and I write in command text box : "pwd"
it should give me the currrent path in result , which I can show in form of HTML as Results ,
(may be in a String form..)
same way if I write in command box : "ls -l"
it should Return me (say a String) the directory listing of the current path in result,
I have already tried the Runtime & Process class ,
Runtime rt = Runtime.getRuntime();
Process p =null;
p = rt.exec("command here");
p.waitFor();
it has following problems:
1) This way I m not able to get the result ..
2) I tried to make a zip file via my program it did not threw any exception , but could not execute...
I was confused is it 'coz of permission ( rights problem) or some programmatical error as the same program runs via a Java Class file ..
desperately waiting for ur suggestions
Dhiraj Agrawal
MCA student and a Trainee in a local Software House
reply to: [email protected]
Maybe you are looking for
-
Error when importing object "MC11VA0ITM_TAB".
Hi SDN, Error in ABAP application program. The current ABAP program "SAPLMCEX" had to be terminated because one of the statements could not be executed. This is probably due to an error in the ABAP program. When attempting to import data, the structu
-
Hi, I try to pass "Test Plan Secure Network Communications BC-SNC" for SNC-adapter, developed our team. Problem occur on step "2.11 Testing Secure КАС-connections, front end to SAP (SAPINFO) (2.11.2 RFC with load-balancing (RFC Type B))". I created P
-
In process withdrawling quantity not showing zero when reverse has been don
Hello I want to know about process order period is close and reverse has been done in this month in process order not showing withdrawl quantity zero in process order. Reversal done with MB1A using movement type 262 Regards, Ram Rathode
-
When I try to download and install itunes
When I try to download and install intunes it gets to after it installs quicktime and then says it cant go any further because the itunes.cab file is corrupt, what do I do I need my itunes.
-
RTV PO blocked for export in GTS
Hi Experts, I've successfully been able to convert an RTV PO to viewed as an export document (expord) in GTS in order to compliance checks. This was done by leveraging SAP note 676301. Users then release the items that are blocked from /SAPSLL/