How to execute unix shell script in webdynpro?

hi all,
  We have some iquirement of executing script in unix.If anyone know How to execute unix shell script in webdynpro?
best regard
reefish

Ree,
1. Find SSH client for windows, then execute SSH with Runtime.exec() on local host with arguments like remote host, auth, command to execute etc.
2. Get SSH client in Java and execute SSH commands on remote host using pure Java API.
Don't ask me for links, Google works today, I checked this
Valery Silaev
SaM Solutions
http://www.sam-solutions.net

Similar Messages

  • How to execute unix shell script from Java ...

    Hi,
    Anyone know how to execute unix shell script from Java?
    Suppose I have several shell scripts written in perl or tcl or bash.
    I just want to catch the output of that script.
    Is there any ready to use module/object for this?
    Please let me know, this is quite urgent for my study assigment.
    Thanks in advance,
    Regards,
    me

    Look up Runtime.exec()

  • Error while executing unix shell script from java program

    Hi All,
    I am trying to execute unix shell script from a java program using Runtime.execute() method by passing script name and additional arguments.
    Code snippet :
    Java Class :
    try{
         String fileName ="test.ksh";
         String argValue ="satish"; // value passed to the script
         String exeParam = "/usr/bin/ksh "+fileName+" "+argValue;
         Process proc = Runtime.getRuntime().exec(exeParam);
         int exitValue = proc.waitFor();
         sop("Exit Value  is : "+exitValue);
    catch(Exception e)
    e.printStackTrace();
    }Test.ksh
      export -- application realated paths..
      nohup  abc.exe 1> test.log 2>&1;
      $1
      exit.By running the above java class , i am getting exit Value: 139 and log file test.log of 0 bytes.
    when i am running the same command (/usr/bin/ksh test.ksh satish) manually, it's calling abc.exe file successfully
    and able generate the logs properly.
    Pls let us know where exactly i am stuck..
    Thanks in advance,
    Regards,
    Satish

    Hi Sabre,
    As per the guidelines provided by the article, i had done below changes..
    InputStream is = null;
    InputStreamReader iStreamReader = null;
    BufferedReader bReader = null;
    String line = null;
    try{
    String fileName ="test.ksh";
    String argValue ="satish"; // value passed to the script
    String exeParam = "/usr/bin/ksh "+fileName+" "+argValue;
    Process proc = Runtime.getRuntime().exec(exeParam);
    is = proc.getErrorStream();
    iStreamReader = new InputStreamReader(is);
    bReader = new BufferedReader(iStreamReader);
    System.out.println("<ERROR>");
    while((line = bReader.readLine()) != null)
    System.out.println("Error is : "+line);
    System.out.println("</ERROR>");
    int exitValue = proc.waitFor();
    sop("Exit Value is : "+exitValue);
    catch(Exception e)
    e.printStackTrace();
    Now , it's showing something like..
    <ERROR>
    </ERROR>

  • RFC_REMOTE_PIPE is Returning 1 alwasys and not able to execute Unix shell script

    Hello All,
    I am trying to execute a simple unix shell script from ABAP.
    What I did so far..
    1. created a test.sh file  with single command echo "Hello".
    2.  placed this file on application server /Usr/sap/test.sh
    3. executing ABAP program which as FM RFC_REMOTE_PIPE
    CODE:
    CALL FUNCTION 'RFC_REMOTE_PIPE'
       DESTINATION 'SERVER_EXEC'
    EXPORTING
       command  = lv_command
       read          = 'X'
    TABLES
       pipedate    =  lt_stdout
    EXCEPTIONS
    system_failure  = 1
    communication_failure = 2.
    if i populate lv_command  = echo "hello" it works fine
    if i give .sh file path in lv_command it is not working. it returns 1.
    Please help...
    I was searching SDN i found that rfcexec service should be enabled... how do i check that..
    i checked t code  \SMGW , i don't see any output...
    i checked FM GWY_READ_CONNECTED_SYSTEMS, i don't hsee anyting related to unix...
    Please suggest.

    I resolved the issue.
    It was issue with permission.
    Script file should have full permission ( Mode 777)..
    Thanks everyone.

  • How to run unix shell script from java web applet

    hi all
    i have created one java applet. my apache web server is on unix server.
    i have created one shell script in same directory where my .class and .htm files reside...
    how to run this shell script from applet? it should search this .sh file on server and not on the client browser machine...
    thanks in advance

    I suppose you could make the shell script into a CGI, configure the server to execute CGIs, and then make the applet open the URL of that CGI.

  • Executing Unix shell scripts with DBMS_SCHEDULER

    I have the following Unix shell script create_backup_file.sh:
    #!/usr/bin/ksh
    /usr/bin/ssh [email protected] /usr/bin/touch/app_home/home/trotestbat/scripts/TRO_batch_complete_`date +%d-%m-%Y-%H%M`
    If I execute this from the command prompt it creates the file on the remote server.
    I've used dbms_scheduler to try and execute this from Oracle:
    BEGIN
    SYS.DBMS_SCHEDULER.CREATE_PROGRAM
    program_name => 'CREATE_TRO_BACKUP_FILE'
    ,program_type => 'EXECUTABLE'
    ,program_action => '/APP/TORPEDO/DTE/SCRIPTS/create_backup_file_tro.sh'
    ,number_of_arguments => 0
    ,enabled => TRUE
    ,comments => NULL
    SYS.DBMS_SCHEDULER.CREATE_JOB
    job_name => 'DTE.TESTAGAIN'
    ,start_date => TO_TIMESTAMP_TZ('2010/05/17 16:09:24.710789 +01:00','yyyy/mm/dd
    hh24:mi:ss.ff tzh:tzm')
    ,repeat_interval => NULL
    ,end_date => NULL
    ,program_name => 'DTE.CREATE_TRO_BACKUP_FILE'
    ,comments => NULL
    END;
    The problem I have is that scheduler executes the shell script and creates the file but it never completes the job. The status of the job is permanently 'RUNNING'. Why is the scheduler not returning a completed status?

    the "infinite" script is usually caused by a prompt (script pauses for a user input).
    Please keep in mind that executing script via scheduler is not the same as manually via prompt.
    1. the script runs as ORACLE user ID (or whatever you specified using DBMS_SCHEDULER.create_credential or/and "$ORACLE_HOME/rdbms/admin/externaljob.ora")
    2. the environment variables are probably not the same.
    My wild guess is that you never ran SSH using "oracle" UID and thus it prompts for permission to add the remote computer’s fingerprint to the user’s ~/.ssh/known_hosts file - since it is a script, it just hangs and waits for input.
    Did you try to login to unix box as oracle uid and run the script manually?

  • How to execute a shell script?

    Hi,
    could someone please tell me the correct way to execute a shell script? For example run.sh located in my resources?
    Thanx in advance!

    Odds are good that Apple doesn't want you running shell scripts on an iPhone, but somebody else might have information to the contrary.

  • How to execute power shell script file inside DSC script resource

    Hi,
    How to execute /call powershell scirpt file inside DSC script resource , some thing like below and capture the status of execution.
    Node $AllNodes.NodeName
    Script ExecuteSQLDeploy
    #SetScript = {powershell.exe .\SQLDeploy.ps1  "param1" "param2" "param3" "param4" "param5" }
    #TestScript= {powershell.exe .\SQLDeploy.ps1  "param1" "param2" "param3" "param4" "param5 }
    #GetScript= { return $true;}
    Basawaraj

    Thanks for reply. 
     Now i am able to execute the power shell script with DSC. I  am getting no error when i run , but the script logic wrote inside  ( deploying sql incremental changes ) not working . I am using SQLCMD in the powershell script to deploy sql
    changes . Can you please elaborate on "script is compatible with DSC" , the script
    should not contain write-host cmdlet.... etc something like that.
    Copying recursively from ****************************** to ************************** succeeded.
    Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
    An LCM method call arrived from computer ************ with user sid **********************************************
    [V-BAKANT]: LCM:  [ Start  Set      ]
    [V-BAKANT]: LCM:  [ Start  Resource ]  [[Script]ExecuteSQLDeploy]
    [V-BAKANT]: LCM:  [ Start  Test     ]  [[Script]ExecuteSQLDeploy]
    [V-BAKANT]: LCM:  [ End    Test     ]  [[Script]ExecuteSQLDeploy]  in 0.1110 seconds.
    [V-BAKANT]: LCM:  [ Start  Set      ]  [[Script]ExecuteSQLDeploy]
    [V-BAKANT]: LCM:  [ End    Set      ]  [[Script]ExecuteSQLDeploy]  in 0.3010 seconds.
    [V-BAKANT]: LCM:  [ End    Resource ]  [[Script]ExecuteSQLDeploy]
    [V-BAKANT]: LCM:  [ End    Set      ]
    [V-BAKANT]: LCM:  [ End    Set      ]    in  0.8810 seconds.
    Operation 'Invoke CimMethod' complete.
    Time taken for configuration job to complete is 0.923 seconds
    Basawaraj

  • Execute unix shell script using DBMS_SCHEDULER

    Hi,
    I am trying run to shell script using DBMS_SCHEDULER.
    1) I check..nobody user exist on my HP-UX.
    2) I check externaljob.ora on (10.2.0.2.0) also..It has an entry..
    run_user = nobody
    run_group = nobody
    3) I created job successfully and enabled it.
    begin
    DBMS_SCHEDULER.CREATE_JOB
    job_name => 'test_unix_script',
    job_type => 'EXECUTABLE',
    job_action => '/tmp/test.ksh',
    start_date => '08-NOV-2006 04:45:16 PM',
    job_class => 'DEFAULT_JOB_CLASS',
    enabled => TRUE,
    auto_drop => FALSE,
    comments => 'test_unix_script.'
    END;
    EXEC DBMS_SCHEDULER.enable('test_unix_script');
    4) test.ksh script had -r-xr-xr-x permission.
    5) When I checking dba_scheduler_job_run_details view, ADDITIONAL_INFO column display following error messgae.
    ORA-27369: job of type EXECUTABLE failed with exit code: No such file or directory
    Did I miss anything?
    Any help will be appreciated!!
    Thanks..

    My /tmp/test.ksh trying to find database status.
    . ~oracle/.profile > /dev/null
    db_status=`eval sqlplus -s 'system/passwd@DEV' << EOF
    set pagesize 0 feedback off verify off heading off echo off
    select status from v\\$instance;
    exit
    EOF`
    echo $db_status > /tmp/db_status_out

  • How to execute a shell script which is present in remote machine using ODI

    I have requirement of executing a batch (shell script) which is present in the remote machine.
    i have an ODI agent in remote machine as well. I have created agent locally by using the remote machine IP and port.
    I am able to test the agent successfully. But when i am executing the package using that agent it is failing with the following error
    errorODI-1226: Step Execution of the Scenario REMOTE_DEMO version 001 fails after 1 attempt(s).
    ODI-1241: Oracle Data Integrator tool execution fails.
    Caused By: oracle.odi.runtime.agent.invocation.InvocationException: HTTP/1.1 500 ODI-1423: Warning connecting to Agent localagent: work repository WORKREP1 is not bound to the master
    My Work Repository Name is : WORKREP1
    Remote Work Repository Name is:WORKREP_LOCAL.
    Could anyone please help me regarding this.
    I can't download shell script and run it locally this needs to be run on that remote machine only.
    Thanks
    senthilkumar

    This is the code.
    1. we can declare types dynamically
    2. Internal table dynamically
    3. Select querry dynamically
    just copy paste this code
    Here is the code for your question
    DATA:v_fieldname
    TYPE fieldname,
    l_PROG TYPE string,
    v_mess TYPE string,
    l_sid TYPE string,
    wa_ddfields TYPE dntab.
    DATA i_tab TYPE STANDARD TABLE OF string.
    DATA:l_str TYPE string,
    l_str1 TYPE string.
    PARAMETERS matnr type marc-matnr.
    end-of-SELECTION.
    *build the subroutine pool
    APPEND 'PROGRAM subpool.' TO i_tab.
    APPEND `LOAD-OF-PROGRAM.` TO i_tab.
    APPEND `DATA i_tab1 TYPE TABLE OF vbak.`      TO i_tab.
    APPEND `DATA l_rows TYPE i.`      TO i_tab.
    APPEND `select * into table i_tab1 from vbak.` To i_tab.
    append 'DESCRIBE TABLE i_tab1 LINES l_rows.' to i_tab.
    append 'Write :  l_rows .' to i_tab.
    GENERATE SUBROUTINE POOL i_tab NAME l_PROG
    MESSAGE v_mess
    SHORTDUMP-ID l_sid.
    IF sy-subrc = 0.
    PERFORM ('LOOP_AT_TAB') IN PROGRAM (l_PROG) IF FOUND.
    ELSEIF sy-subrc = 4.
    MESSAGE v_mess TYPE 'I'.
    ELSEIF sy-subrc = 8.
    MESSAGE l_sid TYPE 'I'.
    ENDIF.
    Edited by: vijay wankhade on Jan 1, 2009 5:34 PM
    Edited by: vijay wankhade on Jan 1, 2009 5:34 PM

  • How to run Unix Shell Scripts

    I hope someone knows Unix better me. I created a shell script to run some ap comp sci classes, and whenever I want to run the script, I'm forced to type:
    "./runMBS", while I want to just type "runMBS". Any suggestions will be nice.
    Thanks

    If you only type the name of a command (or script) the Unix shell only looks for those commands in the directories specified in the $PATH variable. If you provide a full or partial path to the command then the shell will run the command at that location... that's why including "./" in front of your shell script works... it tells the shell to run the command in the current directory (ie "./").
    You can either:
    - move your shell script to one of the directories specified in your $PATH variable
    or
    - add the directory containing your shell script to your $PATH
    To modify the $PATH so that it includes the directory your script resides in use something like this in your .bash_profile:
    <pre>
    PATH=$PATH:/path/to/scriptdir
    export PATH
    </pre>
    Although it's possible to include "./" in your PATH, it's not advisable and can present security problems. Read this explanation for more information.
    Steve

  • Telneting to a remote host and executing unix shell script

    I am using VPN.I want to telnet to a remote server and execute some script there and show it the output in my front end..is it easily possible thru java..i know it can be easily done thru Python...can anyone let me knw if this can ve achieved properly thru java..thnx plz let me knw ASAP.

    Yes surely I have wriiten the code..
    I have first used a Socket to connect to teh host at port 23.
    Then i am using outstream to give the user and passwd .. but in my Inputstream i am getting some vague outputs (some symbols..$,%,etc..) This is the code for ur reference....
    import java.net.*;
    import java.io.*;
    class Telclient {
    public static void main(String args[]) {
    int c;
    try{
    Socket s=new Socket("abc.net",23);
    InputStream in=s.getInputStream();
    OutputStream out=out.getoutputStream();
    String str="user" + "\n" + "password" + "\n";
    byte buf[]=str.getBytes();
    out.write(buf);
    while((c=in.read()) != -1) {
    System.out.println((char)c);
    s.close();
    Please help with teh code , bcoz its not really working..Need urgent helpI also used TelnetClient from jakarta , but failing to understand
    how to use those classes to use..can anyone show me an example...

  • Reg: Unix shell scripts

    Hi all,
    Can any body tell me
    1) How to get file creation time and
    2) whether the file exists or not in UNIX shell scripts
    Regards,
    Pavani

    Hi Pavani,
    Go through this blog, and as mentioned use "Add Time Stamp" to get the file creation time.
    /people/sameer.shadab/blog/2005/09/21/executing-unix-shell-script-using-operating-system-command-in-xi
    Regards,
    Sarvesh

  • Need Example on calling a unix shell script from oracle stored procedure

    Hi
    Can anybody give example on how to call unix shell script from an Oracle stored procedure. Please give a small example on how to do this .I need this urgently please.
    Have a nice time.
    Thanks & Regards
    Jogesh

    If you are on 10g you can also use DBMS_SCHEDULER. See Re: Excute Unix command Using PL SQL

  • Running Unix Shell scripts through Java

    How to run Unix shell scripts through Java program ?

    Use:
    Process p = Runtime.getRuntime().exec("sh script.sh");Then you can use:
    p.getOutputStream and read the output of your program.

Maybe you are looking for

  • Lenovo 3000 N200 0769 BIOS problem

    Hello everybody! I'm a new entry in the forum, but i am a 6 year old user of a Lenovo 3000 N200 (0769) and i am very happy with its services so far! However, after a format that i make, i saw a BIOS update for this model, so i decide to install it. B

  • Exporting a .mp4 at 640x360 and having it be able to play on the iPod

    I have put together a video in Final Cut Express that was in HDV from my video camera. I want it to be able to play in Quicktime and through iTunes in case someone wants to put it on their iPod or iPhone. It works great when played using Quicktime bu

  • Have used PSE11 since Apr, no problems, Organizer wont open

    Have used PSE for years, many versions.  Yesterday, Organizer wont open.  Editor still works fine.  Using PSE 11 on W8 machine with "classic shell". Help

  • XI  3.0 - attribute_inv_snd_serv error

    Hello, I am transferring from 3rd party to Idoc. Is the solution using table IDXNOALE also valid for a receiver IDOC adapter? I entered the values in the table and indeed the "attribute_inv_snd_serv" error disapeared but the message is now in status

  • Plotting XY graph

    Hi guys, I've been assigned to a school project that supposingly I have to do data logging. This project is to log down the data into a Current against Time graph every few intervals form a solar panel. I'm very very new to labview and I have lots of