Track process in linux

i am using Runtime in order to execute a program through my java GUI. how can I keep track of the process in order to be notifiied when the program has finished running????
Thank you in advance

Perhaps Process.waitFor will be of use to you.

Similar Messages

  • Problem of executing a process under Linux using Runtime.exec

    Hi, All
    I am having a problem of executing a process under Linux and looking for help.
    I have a simple C program, which just opens a listening port, accept connection request and receive data. What I did is:
    1. I create a script to start this C program
    2. I write a simple java application using Runtime.exec to execute this script
    I can see this C program is started, and it is doing what it supposed to do, opening a listening port, accepting connection request from client and receiving data from client. But if I stop the Java application, then this C program will die when any incoming data or connection request happens. There is nothing wrong with the C program and the script, because if I manually execute this script, everying works fine.
    I am using jre1.4.2_07 and running under Linux fedora 3.0.
    Then I tried similar thing under Windows XP with service pack2, evrything works OK, the C program doesn't die at all.

    Mind reading is not an exact science but I bet that you are not processing either the process stdout or the stderr stream properly. Have you read http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html ?

  • How to clear Acroread defunct process in Linux?

    Acrobat Reader plugin works fine for first document, but if I close the pdf window and wait ~20 seconds, the Acroread process goes defunct and further attempts to read pdf docs do not display (blank screen). Have tried disabling all other plugins and many extensions. Killing nspluginwrapper manually allows proper pdf reading (for one more doc). This has been going on for a number of Firefox releases.
    ps info:
    11976 ? Sl 0:00 \_ /usr/lib/firefox-7.0.1/plugin-container /usr/lib/nspluginwrapper/plugins/npwrapper.nppdf.so -greomni /usr/lib/firefox-7.0.1/omni.jar 11767 true plugin
    11989 ? S 0:01 \_ /usr/lib/nspluginwrapper/i386/linux/npviewer.bin --plugin /opt/Adobe/Reader9/Browser/intellinux/nppdf.so --connection /org/wrapper/NSPlugins/nppdf.so/11976-2
    12000 ? Z 0:01 \_ [acroread] <defunct>
    The question: Is there something that can be done to fix the problem in Firefox or is it purely an Adobe problem?

    I remember this has been a problem since Ubuntu 9.10 (maybe). It seems that Firefox 3.0+ has a non-robust interface with Adobe PDF reader. Chrome doesn't have this problem on Linux. So I guess the problem is in the plug-inn wrapper. I think Firefox team need to fix this problem ASAP.

  • Process in Linux

    Hello, I am interesting in know what process start up the Oracle WebLogic Server(the admin_server and any managed server) and componentes(OHS, WebCache, etc) in Linux and the specific command to see this process.
    thanks any reply

    try:
    ps -fe | grep "username used to run your WL"
    You'll get lines something like:
    userid ### ### date process
    example:
    ps -fe | grep weblogic
    -- This is the command used to start node manager
    weblogic 26080 1 0 Aug19 ? 00:00:00 /bin/sh ./startNodeManager.sh
    --- This is the node manager process - it was started by the command above ( 26080 )
    weblogic 26103 26080 0 Aug19 ? 00:00:39 /opt/oracle/bea/jdk160_05/bin/java -client -Xms32m -Xmx200m -XX:MaxPermSize=128m -Xverify:none -Djava.security.policy=/opt/oracle/bea/wlserver_10.3/server/lib/weblogic.policy -Dweblogic.nodemanager.javaHome=/opt/oracle/bea/jdk160_05 weblogic.NodeManager -v
    -- This line shows a weblogic server running; it was started by node manager ( 26103 )
    weblogic 32668 26103 1 Nov02 ? 02:53:12 /opt/oracle/bea/jdk160_05/jre/bin/java -Dweblogic.Name=

  • Auto-start OC4J process after Linux reboot

    Oracle 11gR2, OC4J 10g (10.1.3.5.0), RHEL5 64 bit
    Hi All,
    I am trying to figure out how to get my oc4j process start at boot time. I already have a dbora script setup. I tried adding the following line to my dbora/dbstart script but it did not do anything:
    #!/bin/sh
    # chkconfig: 345 99 10
    description: Oracle auto start-stop script.
    ORACLE_OC4J_HOME=/u02/oc4j
    JAVA_HOME=/usr/java/jdk1.6.0_21/
    su - $ORACLE_OWNER -c "$ORACLE_OC4J_HOME/bin/oc4j -start"
    I read somewhere that I may need to put the entire path like:
    /usr/bin/java -jar /path/to/oc4j.jar &
    Just not sure where and how to put that path in the file.
    Thanks for your help all.
    JrOraDBA

    Hi,
    To run oc4j in the background, on Linux
    Execute the following command:
    nohup ./oc4j -start &
    to run oc4j in the background. The 'nohup' command ignores the hangup signal (closing the terminal window) and enables oc4j to continue running in the background.
    In rare cases, oc4j will not shutdown cleanly with the standard command:
    ./oc4j -shutdown -port 23791 -oc4jadmin <admin_pwd>
    In those cases, try the following command:
    java -jar admin_client.jar deployer:oc4j:localhost oc4jadmin <admin_pwd> -shutdown
    to stop the oc4j service.
    Thanks,
    Sharmela

  • Oracle 10g listener processes on linux

    Hi,
    We have databases (10.1.0.3) running on linux x86 (RH AS3) and Tru64 unix.
    I have noticed on linux that there are a number of processes for each listener whilst on Tru64 the listener has only one process.
    Can anyone explain why linux has these extra processes?
    Thanks
    Mark

    Hi Mark,
    I've the similar issue on linux and solaris.It's a bug in 10g .There is a patch available for it.Apply Patch 4518443 for the problem .Or else you can do the work around like adding this text to your listener.ora file will fix the problem. SUBSCRIBE_FOR_NODE_DOWN_EVENT_<listener_name>=OFF
    Regards,
    Gayatri

  • Multiple processes in linux

    i have a doubt. i have made a java program and when i execute it, it create several preocesses (about 10) in linux; why this is happening?
    i thought that the os was creating a single process to every class of my app, but i just use six classes!
    ah, and i need another tip: how to make a application run like a daemon on linux?
    thanx in advance

    okay, but when i use px ax i get all the processess woth the same command line...
    an another thing, every class, when instantiated, generates a thread by the jvm?
    i am certeaIN thayt i ^dont use nine threads (at least in the beginning of the execution of my app), so i dont know why it is showing me a lot of processess

  • Vocal Track processing

    I've recently started working with a great female vocalist. However, her mic technique needs much to be desired. One of the songs we are working on has a wide range of pitch and volume. She goes from very low 'breathy' to moderate volume and the levels are all over the map! So, I have automated the volume of the track to even it out as best as I can.
    Essentially, I guess I'm manually doing what a compressor would do although I still plan to add some light compression to smooth it out.
    Is it standard practice to bounce the track (without the added compression) to get a better raw track then add whatever compression and processing, or to leave the original with the automation and add compression/processing to that..?
    Thanks.

    What I would recommend is to ride the fader with automation on your vocal track, then set the output of that track to come up on a new aux channel, and then add your compression and final automation on the aux channel.
    This lets you manually smooth out the levels before hitting the compressor. No bouncing necessary.

  • Multiple processes under linux

    If I run Java programs under Suse Linux 9.0 using JDK 1.5.0_09 for every started Java programm I can see 9 processes running under linux.
    It seems like one of them is the master and the others are child processes of this one.
    I've never seen this with other Linux / Java versions before.
    Could anyone tell me what's happening there?
    Thanks xccarlsson

    Earlier versions of linux threads were done by mapping each thread onto it's own process and each of these processes shared their address space with an original process, the one you describe as the master. The newer thread model is more like what you'd expect with one process and multiple contexts within the process. So you must be running on system which is using the old threading model.
    tom

  • Defunct Process in Linux

    I´m using a Java Stored Procedure to execute a shell in Linux.
    Prcedure that calls the java source
    PROCEDURE p_wcsmsg (cmd1  IN  VARCHAR2)
    AS LANGUAGE JAVA
    NAME 'Wcsmsg.execute (java.lang.String)';
    Java Source
    create or replace and compile java source named wcsmsg as
    import java.lang.*;
    import java.io.*;
    public class Wcsmsg
    +{+
    public static void execute (String cmd1) throws IOException
    +{+
    String[] CommandWcsmsg = {"/bin/bash", "-c", cmd1};
    Runtime.getRuntime().exec(CommandWcsmsg);
    +}+
    +}+
    Shell:
    JAVA_ROOT=/usr/lib/SunJava2-1.4.2/jre
    +JCMD="${JAVA_ROOT}/bin/java"+
    +$JCMD -cp /bin/wcsmsg/ Wcsmsg+
    When that shell is executed, is created a zombie process:
    ++oracle 16179 0.4 0.0 0 0 ? Z 17:07 0:00 [bash] <defunct>++
    That process can´t killed because is a zombie process.
    How can I prevent this process becomes a zombie prcess?

    When it is modified for this script is displayed the following error
    Code
    create or replace and compile java source named wcsmsg as
    import java.lang.*;
    import java.io.*;
    public class Wcsmsg
    +{+
    public static void execute (String cmd1) throws IOException
    +{+
    String[] CommandWcsmsg = {"/bin/bash", "-c", cmd1};
    +try {+
    Process process = Runtime.getRuntime().exec(CommandWcsmsg);
    process.waitFor();
    +}+
    +catch(IOException e){+
    e.printStackTrace();
    +}+
    +}+
    +}+
    Error:
    Compilation errors for JAVA SOURCE ANTREF.WCSMSG
    Error: Exception java.lang.InterruptedException must be caught, or it must be declared in the throws clause of this method.
    Line: 12
    Text: process.waitFor();

  • Tracking processing log?

    Hi Friends,
    Its a file to file scenario.The sender SAP system writes data to the file.Based on the message no. send by sap(5 characters) how to track the processing log of that particular message processed in xi?
    Thanks,
    Suresh.

    Hi Suresh
    What exactly you want to see log for?
    You can track all the steps happening at PI under SXMB_MONI
    With this you can use SLG1 for application logs.
    Hope this helps.
    Thanks
    Gaurav

  • Many processes in linux

    We are using JDK 1.3.1, HotSpot server version (native threads) virtual machine in linux (slackware).
    Why do I see many processes of the jdk when I do a 'ps -ef'???

    sorry i didnt get back earlier - i wasnt near my Linux box so i couldnt check it out.... I think i was infact right. Try starting your JVM with the -green flag, ( ie java -green )...i think then you will see only one process when you type ps -ef.

  • Trying to execute shell process in Linux

    Hi. I'm trying to execute a simple command in the form of 'bash -c "ls ~root ~"' from within java. I've tried using both the java.lang.Runtime.exec() methods and the java.lang.ProcessBuilder class but both produce the same error message (which I get from the OutputStream of the Process):
    bash: ls ~root ~: command not found
    A command such as 'bash -c "ls"' succeeds, providing the contents of my home directory in the Process's InputStream that I can display from within the program, but one in which there are one or more arguments to 'ls' fails the same way as above.
    It seems that when I have a 'bash -c "ls <arguments>" as the command from within java, bash believes that the entire argument in double quotes ("ls <arguments>") is the command. It doesn't seem to "see" the spaces.
    Would anyone know what I might do in this case? Below is my code:
    import java.util.ArrayList;
    import java.io.*;
    public class ShellCommand {
        public static void main(String args[]) {
            ArrayList<String> shellCommandLine = new ArrayList<String>(3);
            shellCommandLine.add("bash");
            shellCommandLine.add("-c");
            shellCommandLine.add("\"ls ~root ~\"");
            InputStream is = null;
            ProcessBuilder pb = new ProcessBuilder(shellCommandLine);
            pb.redirectErrorStream(true);
            try {
                Process p = pb.start();
                is = p.getInputStream();
                BufferedReader br = new BufferedReader(new InputStreamReader(is));
                String line;
                while ((line = br.readLine()) != null) {
                    System.out.println(line);
                br.close();
            } catch (IOException ie) {
                System.out.println("Error executing external process.\n");
                System.exit(1);
    }

    I have just used Runtime.exec() on        final String[] command = {"bash","-c", "ls ~root ~" };As expected, the stderr stream produces
    ls: /root: Permission denied
    and stdout produces a directory listing of ~ (my home directory).
    You should read the man page for bash -c and read http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html to see how to handle stdout and stderr.

  • Java code running as background process in Linux causes high CPU util.

    I'm running a piece of java code as a background process in Redhat 7.1 . When I specify to run it as a background process (using the '&') at the command line, I get CPU utilization at around 5% and it dips.
    When I edit the script that runs the java code to specify running it as a background process withint the script itself (java ..... &) and then go to the command line and run the script, the CPU utilization shoots up to 95% and stays at the low 90's - very high 80's range for the CPU utilization..
    I'm hoping someone has any idea for this behavior and a way to fix it.
    Thanks in advance,
    Sarat..

    This is an interesting post and i'm sory i don't have time to
    experament before i answer
    you could of course run the script as background
    *.sh &
    but that's probubly not what you want
    I think the solution lies in giving the
    proccess a job number %n
    then setting it %n &
    it might even work to
    put something like %java &
    Anyway when it's running fullout
    it is because it is in the
    current terminal process group PID.
    wish i could help more

  • Java Runtime process, comunication with C in Linux

    Hi guys,
    I have a project with Java GUI and C database. Basically, I need to communicate C in Java through RunTime.exec(String[] s), which returns a Process. From the Process, I can get input and output stream. My question is since Java is using unicode, I wonder if it might be a problem for the C to read the input.
    Since this is the first time I do it, any hints or help about Process in Linux is appreciated.

    I once wrote a program that used sockets between Java and C, and it worked fine. I didn't even think about different encodings (lucky it worked I guess :)

Maybe you are looking for