How to pass runtime process a commmand with pipes?

I have this java program to run commands, but it ignore any command with pipes (e.g., ps -ef | grep -v grep | grep defunct). Any ideas on how to do this?
It tries to pass every after -ef into ps as part of a ps command instead of directing output down the pipe chain...
David
import java.io.*;
public class RunExec {
public static void main(String [] args) {
try {
System.out.println("cmd: " + args[0]);
Runtime r = Runtime.getRuntime();
Process p = r.exec(args[0]);
BufferedReader err = new BufferedReader (
new InputStreamReader(p.getErrorStream())
BufferedReader in = new BufferedReader(
new InputStreamReader(p.getInputStream())
for(;;) {
String line = in.readLine();
if ( line == null ) {
break;
} else {
System.out.println(line);
String errors;
while ((errors = err.readLine ())!= null) {
System.out.println (errors);
err.close();
in.close();
} catch(IOException e) {
System.out.println(e);
}

I'm sure you realize this has nothing to do with java, and everything to do with your shell. You must escape all shell-sensitive characters for them to ever reach java:
$ java RunExec ps -ef\|grep -v grep \|grep defunct

Similar Messages

  • How to pass runtime parameters to MySQL Query from xMII server

    Please can anybody help in How to pass runtime parameters to Orcle Query from xMII server

    The answer is the same as for your other thread.  The mechanism is the same regardless of the end database.  The SQL  syntax will be different for each database vendor depending upon which functions you are invoking.  The main areas of difference between SQL Server, Oracle, DB2, etc. deal with dates (times also) and strings, but there are others as well.
    Regards,
    Mike

  • How to pass runtime parameters to Oracle Query from xMII server

    Please can anybody  help me that how to pass runtime parameter to Orcle Query  from xMII server.

    It works the same way as I described in this thread [How to pass runtime parameters to MySQL Query from xMII server].  It does not matter the datasource MII will work the same for all queries, at least for passing in parameters.  How to write those queries and their datatypes will be the differences.

  • How to pass record Group from Forms with DATA_PARAMETER to Reports Server

    How to pass record Group from Forms with DATA_PARAMETER to Reports Server using RUN_REPORT_OBJECT?
    When we use products on run time we are using data_parameter for passing record Groups to reports via run_product but now we have to use application server and reports server for same reports.
    We met with <FRM-41214 Unable to run reports> for passing DATA_PARAMETER to reports server when used RUN_REPORTS_OBJECT.
    How can we pass record Group from Forms with DATA_PARAMETER to Reports Server using RUN_REPORT_OBJECT?
    Thanks,
    Arif

    Hi Mandeep,
    Could you please tell me how can i pass data parameter from forms to report through run_product.

  • How to test BPEL Process that starts with a pick consuming a JMS message

    Hi,
    We are using App Server v 10.1.3.3.0 and attempting to test a BPEL process which starts with a pick operation which is awaiting a JMS message on a specific queue.
    We are using the Oracle JMS adapter to achieve this.
    Is there any way in which this particular configuration can be easily tested using the BPEL testing framework? I have problems when I write the first initiate XML statement in my test case (stack trace below)
    <2011-01-27 10:23:47,028> <ERROR> <ProvisioningInterface.collaxa.cube.bpeltest> test run failed!
    ORABPEL-20011
    Instance initiation error.
    An error occurred while launching an instance for suite "BasicTest", test "baseline.xml".
    Please examine the log file for details or contact the system administrator.
    at com.collaxa.cube.engine.test.BPELTestRunManager.initiate(BPELTestRunManager.java:218)
    at com.collaxa.cube.ejb.impl.BPELTestBean.runSuites(BPELTestBean.java:625)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    Unfortunately, there are no further details or any example I can see which simulate the kind of setup I have for my test.
    Any help much appreciated,
    Kind Regards,
    Colin.

    Hi,
    I assume you mean the JMS example under the $OH BPEL examples area. Unfortunately, this only shows how to get a BPEL process kicked off by awaiting a JMS message - but there is no test code there! There are specific examples which show off the testing framework facilities but it appears that all the examples which use async type of interactions are in the middle of a process which is kicked off by a normal synchronous client interaction.
    Any further help much appreciated.
    Colin.

  • How to make button to format a HardDrive or USB, How to remove all files from folder, and How to delete a process in listbox with a textbox?

    Hello!
    Here's the question with explaniation: How can i format the USB or Drive by clicking a button what's meant for it?
    and the second question what's also in vb.net: How can i remove all files from folder ? 
     Here's the Look of program: *
    Using the PC button, it will delete the free space of the PC, do you guys/girls know where it's location?

    Example Code:
    Imports System.Runtime.InteropServices
    Imports System.IO
    Public Class Form1
    Dim CBoxDrives As New ComboBox
    WithEvents FButton As New Button
    <DllImport("shell32.dll")> _
    Private Shared Function SHFormatDrive(ByVal hwnd As IntPtr, ByVal drive As UInteger, _
    ByVal fmtID As UInteger, ByVal options As UInteger) As ULong
    End Function
    Private Enum SHFormatFlags As Integer
    SHFMT_ID_DEFAULT = &HFFFF
    SHFMT_OPT_FULL = &H1
    SHFMT_OPT_SYSONLY = &H2
    SHFMT_ERROR = &HFFFFFFFF
    SHFMT_CANCEL = &HFFFFFFFE
    SHFMT_NOFORMAT = &HFFFFFFD
    SHFD_FORMAT_FULL = 0 ' full format
    SHFD_FORMAT_QUICK = 1 ' quick format
    End Enum
    Private Sub FButton_Click_1(sender As System.Object, e As System.EventArgs) Handles FButton.Click
    If CBoxDrives.Text = "" Then
    MsgBox("No Drive Selected")
    Exit Sub
    End If
    Dim Iresult As ULong = SHFormatDrive(CType(Me.Handle.ToInt32, IntPtr), CUInt(Asc(CBoxDrives.Text.Substring(0, 1)) - Asc("A")), CUInt(SHFormatFlags.SHFMT_ID_DEFAULT), 1)
    End Sub
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    Me.Size = New Size(200, 100)
    With FButton
    .Size = New Size(50, 25)
    .Location = New Point(5, 5)
    .Text = "Format"
    End With
    Me.Controls.Add(FButton)
    With CBoxDrives
    .Size = New Size(50, 25)
    .Location = New Point(75, 5)
    .DropDownStyle = ComboBoxStyle.DropDown
    End With
    Me.Controls.Add(CBoxDrives)
    Dim DrivesFound As Integer = 0
    Dim allDrives() As DriveInfo = DriveInfo.GetDrives()
    Dim d As DriveInfo
    For Each d In allDrives
    If ((d.DriveType = DriveType.Fixed) Or (d.DriveType = DriveType.Removable)) AndAlso Environment.GetEnvironmentVariable("SYSTEMROOT").StartsWith(d.Name) = False Then
    CBoxDrives.Items.Add(d.Name)
    DrivesFound += 1
    End If
    Next
    CBoxDrives.SelectedIndex = DrivesFound - 1
    End Sub
    End Class

  • How to pass system date and time with tabular from in Update only Mode.

    Dear Friends,
    i have created tabular form with UPDATE Only .here i am assigning work to another multiple users.i want to insert system date and time when i assign work to multiple users.
    How can i insert system date and time into table using tabular form in Update Only Mode.
    beacuse i have pass in default system date it's working only with add row button.
    How can i pass system date and time in update mode in tabular form.
    Thanks

    Hi,
    You just create a trigger on the table on which you build your tabular form:
    e.g:
    CREATE OR REPLACE TRIGGER  "AUDITING"
    before insert or update on "MYTABLE"
    for each row
    begin
        if inserting then
            :new.created_on := localtimestamp;
            :new.created_by := nvl(v('APP_USER'),user);
        elsif updating then
            :new.updated_on := localtimestamp;
            :new.updated_by := nvl(v('APP_USER'),user);
        end if;
    end;Regards,
    Fateh

  • How To Pass Multiple Parameters In URL with Report Builder

    Hi,
    I use apex 4.2 with database xe 11g and i use report builder to build my report i use this link to call report
    function runrep(){
    var vurl = 'http://192.168.0.57:8889/reports/rwservlet?userid=retail/1@xe&destype=cache&desformat=PDF&paramform=no&report=item_cost&P_BATCH_NO='+$v('P138_BATCH_NO');
    popupURL(vurl);
    now i want to pass Multiple Parameters like P138_ITEM_CODE , P138_UOM_CODE
    how can i add this Parameters in URL ?
    Regards
    Ahmed

    Ramani_vadakadu wrote:
    window.open("http://hq-orapp-03.kuf.com:9704/xmlpserver/~weblogic/kufpec/BTA/KUF_CONF_ITINUD.xdo?_xpf=&_xpt=1&_xdo=%2F~weblogic%2Fkuf%2FBTA%2FKUF_CONF_ITINUD.xdo&_xmode=&_paramsP_BTM_ID="+parseInt(document.getElementById('P3_BTA_ID').value)+"&_xt=KUF_CONF_ITINUD&_xf=pdf&_xautorun=true&id=weblogic&passwd=kuf2011","_blank");
    the above code we are using apex JS to BI publisher calling for report as PDF
    i don't know exactly where your parameters , did you customize my link to multiple parameters
    'http://192.168.0.57:8889/reports/rwservlet?userid=retail/1@xe&destype=cache&desformat=PDF&paramform=no&report=item_cost&P_BATCH_NO='+$v('P138_BATCH_NO'); 

  • How to pass variables to Skin applied with skinClass?

    Hi all,
    I'm experimenting with new skin for a SkinnableContainer, and I would like to pass variables to that skin to dynamically change some elements.
    This is how I would like it to work, but it doesn't. Is there a way to make it work? (Or something similar... like defining new stylesheet-elements in the skin.)
    <s:SkinnableContainer skinClass="skins.SkinnableContainerBackground" gradient1="0xFFF000" gradient2="0x000FFF>
    <s:RichText id="rt1" width="400" height="200"  />
    </s:SkinnableContainer>
    Skin:
    <s:Skin xmlns:s="library://ns.adobe.com/flex/spark"
            xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:d="http://ns.adobe.com/fxg/2008/dt"
            xmlns:ai="http://ns.adobe.com/ai/2008"
            height="100%"
            width="590">
        <s:layout>
            <s:BasicLayout/>
        </s:layout>
        <s:states>
            <s:State name="normal"/>
            <s:State name="disabled"/>
        </s:states>
        <fx:Metadata>[HostComponent("spark.components.SkinnableContainer")]</fx:Metadata>
        <fx:Script>
            <![CDATA[
                [Bindable] public var gradient1:uint;
                [Bindable] public var gradient2:uint;
            ]]>
        </fx:Script>
        <s:Group top="0"
                 bottom="0"
                 left="-11"
                 right="0">
            <s:Group x="15"
                     top="0"
                     bottom="0"
                     id="kaft">
                <!--            <s:filters>
                     <s:DropShadowFilter alpha="0.4"
                     blurX="6"
                     blurY="6"
                     distance="4.24264"
                     quality="3" />
                     </s:filters>
                -->
                <s:Rect width="586"
                        ai:knockout="0"
                        d:userLabel="kaft"
                        top="0"
                        bottom="0">
                    <s:fill>
                        <s:LinearGradient y="82.3125"
                                          scaleX="585.975"
                                          rotation="-0">
                            <s:GradientEntry color="{gradient1}"
                                             ratio="0.466667"/>
                            <s:GradientEntry color="{gradient2}"
                                             ratio="1"/>
                        </s:LinearGradient>
                    </s:fill>
                </s:Rect>
            </s:Group>
        </s:Group>
        <s:Group id="contentGroup"
                 left="20"
                 right="20"
                 top="10"
                 bottom="20">
            <s:layout>
                <s:BasicLayout/>
            </s:layout>
        </s:Group>
    </s:Skin>

    ou can also define custom CSS styles:
    MySkinnableContainer.as
        [Style(name="gradientA", type="uint", format="Color", inherit="no")]
        [Style(name="gradientB", type="uint", format="Color", inherit="no")]
        public class MySkinnableContainer extends SkinnableContainer
            public function MySkinnableContainer()
                super();
    MySkinnableContainerSkin.mxml
    <s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/halo"
                 xmlns:s="library://ns.adobe.com/flex/spark">
        <fx:Metadata>
            <![CDATA[
            [HostComponent("MySkinnableContainer")]
            ]]>
        </fx:Metadata>
        <s:states>
            <s:State name="normal" />
            <s:State name="disabled" />
        </s:states>
        <s:Group bottom="0" left="-11" right="0" top="0">
            <s:Group id="kaft" x="15" bottom="0" top="0">
                <s:Rect width="586" bottom="0" top="0">
                    <s:fill>
                        <s:LinearGradient y="82.3125" scaleX="585.975" rotation="-0">
                            <s:GradientEntry color="{getStyle('gradientA')}" ratio="0.466667" />
                            <s:GradientEntry color="{getStyle('gradientB')}" ratio="1" />
                        </s:LinearGradient>
                    </s:fill>
                </s:Rect>
            </s:Group>
        </s:Group>
        <s:Group id="contentGroup" bottom="20" left="20" right="20" top="10" />
    </s:SparkSkin>
    styles.css
    @namespace local "*";
    local|MySkinnableContainer {
        gradientA: #FF0000;
        gradientB: #000FFF;
        skinClass: ClassReference("MySkinnableContainerSkin");   
    main app:
        <fx:Style source="styles.css" />
        <local:MySkinnableContainer width="590" height="100%">
            <s:RichText id="rt1" width="400" height="200" color="#000000" text="test" />
        </local:MySkinnableContainer>

  • How to specify the Process Flow Module with SQLPLUS_EXEC_TEMPLATE.SQL ?

    Hi, we have a couple of process flow modules that have PF Packages and Process Flows with the same name.
    E.g
    PFMOD1 (Module)
    FILELOAD (Package)
    PF1 (Pf)
    PFMOD2 (Module)
    FILELOAD (Package)
    PF1 (Pf)
    Normally we can specify "FILELOAD/PF1" as a paramater to the procedure SQLPLUS_EXEC_TEMPLATE.SQL in order to initiate the running of an OWB process flow but how can the system distinguish between modules ?
    Anyone done this ?
    Thanks
    Paul

    If you deployed the packages to the same location then the second deployment replaced the result of the first one (actually a new version of the process flow was created). You can execute only the latest version...
    Regards,
    Robert

  • How to create and process Iinteractive report with selected records in 4.1

    Hi,
    I want to have an Interactive report that will have in front of each row a checkbox that can be selected for batch processing. Is there a way to do so?
    If there is please include some method to process those records i.e. for each selected record create a new record on a different table and update the record itself as processed.
    thanks
    Edited by: yannisr on Jul 13, 2012 5:58 AM

    For this you need to consult APEX documentation for two things
    Create a checkboxes using APEX_ITEM API
    How to reference those checkboxes within an On Submit Process

  • How to pass prompt value to columns with formula?

    Hello guys
    I have a situation:
    I have a report with 1 column name 'product' and in this column it has a case statement like 'case when item is ('a','b','c','d') then 'Men' else 'women' end'
    Then I have created a dashboard prompt of the exact same column, and I defined the same case statement in the prompt's column formula as the same.. Then I tested the prompt and it is returning only 2 values 'men', 'women'..
    However, when putting the prompt and report on the same dashboard, the report is not accepting the prompt values..
    Then I set the presentation variable on the prompt and call it 'Product', then in the report I created a filter on 'product' column as equal to presentation variable 'product'--- I tried with and without single quotes.. So the filter itself looks like : case when ...... is equal to / is in @{product}
    However, when I then return back to the dashboard, I am getting the error:
    State: HY000. Code: 388918336. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27005] Unresolved column: "Product". (HY000)
    Could anyone help?
    Thanks

    Hola
    is possible that are you using a BINS agrupation into the Column Formula?
    if you form a CASE statement using a Bins agrupation, in the column Formula, this must be disabled to match statements between columns and DB Prompt
    if you are using a BINS agrupation to form the CASE statement, you have to delete the bins agrupation in the Column but keep the CASE statement
    Regards

  • How to create Schema Header and footer with Pipe delimiter file..?

    Hi all,
    I have issue with creating Schema Header and footer with body file ..The file format is Pipe delimiter.. The follwing file below like is...
    Adapters:File Adapter(Read)-11g.
    1|000|2025|SDFG|54787
    1|2055|244|9566|000|000|044|2577|361147|45554|wweqw|52555|564|000|647|464
    1|2027|344|4566|000|000|044|8577|361147|45554|wweqw|82555|564|000|647|844
    1|2024|444|6566|000|000|044|9577|361147|45554|wweqw|12555|564|000|647|544
    1|2023|544|8566|000|000|044|5577|361147|45554|wweqw|52555|564|000|647|442
    1|2022|644|3566|000|000|044|7577|361147|45554|wweqw|02555|564|000|647|448
    1|0000|546|25544|454
    If you have sollution for this, please help me out..Thank you.

    You mean how many rows or columns..?
    If coloumns means 5 and rows only one(1).

  • Process of login with ADF security

    Hi,
    I was looking at how to implement the process of Login with the ADF security using JDev 11g and I feel very good...
    My question is if it is possible to use this tool in case of use a container as Tomcat 6.x or JBoss. If it is possible to use ADF security for these containers, what should be configured to work?

    Hi,
    ok, I'd like to use authorization with ADF security, but as you say it is not possible in Tomcat. well, but could implement it, if there must be 3 users with different roles of the little system that I want to develop. Any idea?. There maybe a small example with user roles to use without authorization of ADF security?.

  • How to deactivate rebate processing

    Dear All,
    How to deactivate rebate processing.
    Thanks with Reagrds
    Subrat

    Thanks for the reply
    when i am going to save after deactivating the billing type and sales organization
    its not generating any transport request so that i can transport the configuration to PRD server.
    when i m saving it , it poping up with this message
    "Billing index had to be recreated
    because changes were made to
    rebate
    Do you want to create a new
    billing index for rebate?"
    after this Yes or No is coming
    if i am choosing yes one another screen is coming which is for new index generating.
    and after this also no transport request is genarating.
    please help.

Maybe you are looking for