Call a unix command

Hi Community,
It's possible to create a program that a call does a unix command.
I would like created a synchronous scenario.
Then the program call a unix command and this is waiting up to when a unix command termined a runtime.
The command returned a data and the ABAP program will owe to take back the esecution.
I hope in you
Thank's everybody.

Hi Antonello,
i'd do it with different job steps (SM36)
1) Program1, which does a unix command:
syntax:
  CALL 'SYSTEM' ID 'COMMAND' FIELD COMMAND
                ID 'TAB'     FIELD TABL-SYS.´
or have a look here: external commands
2) Program2 handle the output (e.g. a file) of program 1
regards Andreas

Similar Messages

  • Calling an unix command from a java program which runs on windows

    Hello All
    I have an Java Application which is run on windows server (I)
    I have another Sun Server (II)
    I want to call an unix command on server(II) from java application which is on server(I)
    I am using Samba Server in order to share files between Windows Server and Unix Server
    Can I use samba in order to call command
    or is there any way to open an telnet session within java application
    I will be grateful if you give me some suggestion on this issue
    Regards
    BEKIR BALCIK
    J2EE Application Developer
    Argela Technologies ...

    cross post
    http://forum.java.sun.com/thread.jspa?threadID=624601&messageID=3553626#3553626

  • Calling an Unix command on Remote sun Server in a Java Code

    Hello All
    I have an Java Application which is run on windows server (I)
    I have another Sun Server (II)
    I want to call an unix command on server(II) from java application which is on server(I)
    I am using Samba Server in order to share files between Windows Server and Unix Server
    Can I use samba in order to call command
    or is there any way to open an telnet session within java application
    I will be grateful if you give me some suggestion on this issue
    Regards
    BEKIR BALCIK
    Argela Technologies ...

    Can I use samba in order to call commandYes, smaba supports "magic" files that cause a program to be executed when they are accessed. Note, this does not provide for arguments but you can put these in a file which you command reads.
    or is there any way to open an telnet session within java applicationYes. just use a Socket connection.

  • Calling a Unix Command from Java

    Hi all,
    I'm not a Java guy, I need a small help, I need a code which will call a Unix Command called from a Java code. For Example I need a Java code whereby I should be able to do a 'ls -lt' on my Unix box. Can anybody please help.
    Thanks,
    Shantanu

    See Runtime.exec()

  • ASAP: How a stored proc calls OS(unix)Commands

    urgent!!
    My stored procedure requires to call unix commands HOW DO I DO IT?
    my rqrmnt is :
    stored proc is :-
    1.for each file in a directory($ls)
    do
    2.sql stmnts of insert etc
    /OR
    use sqlldr for the same.
    done.
    ** how do i do both the operations 1&2 in the same Oracle procedure?

    I know HOST can be used in form for OS command but I never thought about doing OS command in the stored procedure.
    Hmm...........
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by [email protected] ... ([email protected]):
    urgent!!
    My stored procedure requires to call unix commands HOW DO I DO IT?
    my rqrmnt is :
    stored proc is :-
    1.for each file in a directory($ls)
    do
    2.sql stmnts of insert etc
    /OR
    use sqlldr for the same.
    done.
    ** how do i do both the operations 1&2 in the same Oracle procedure?
    <HR></BLOCKQUOTE>
    null

  • Calling unix command in Apex Window

    I am working on a small project where in; it would be handy to run an external plsql in oracle database which calls for unix command such as tail -f alert.log or tail -1000 alert.log when a button is pressed in the application.
    I know the client and server aspect and very difficult to forward the server output to Application specially web based but still thought of trying my luck to get some insights from this forum .
    Is this possible in Apex ?
    UK

    Don't see why not. All the building blocks are there (assuming a recent version of the database, and that 1000 is a realistic metric of the data volume):
    1. A script to run the required UN*X commands.
    2. An initial log extract file created manually using the script.
    3. An external table on the log extract file.
    4. An external scheduler job to rerun the log extract script to refresh the log extract.
    5. An APEX page with a report based on the external table, and a button that calls the external job.
    Note that providing relevant information when asking a question is helpful in determining a solution:
    - APEX version
    - DB version and edition
    - Web server architecture (EPG, OHS or APEX listener)
    - Browser(s) used
    - Theme used
    - Templates used

  • Call unix command in sqlplus script

    Hello, I wanna to know how to call a unix command in the sqlplus script.
    For exemple,
    I've a sqlplus script to lauch a oracle report, after the report is generated, I wanne to replace the output file in an other directory.
    So that, I have to call the unix command mv here in the sqlplus script
    How can I do it?**
    I completed my situation:
    I don't have dbms_scheduler untility in my database.
    Thanks a lot for your help
    Edited by: user11930885 on 17 janv. 2010 14:53

    Yes, at the begining, I'll tried the unix shell by calling SQL.
    I've the problem of passing the parameters through.
    It seems to me
    we can use
    Host in the SQLPLUS to run the unix command.
    but I've written it in my sqlplus script, it doesn't work. so I wanna to find an exemple how to use HOST in sqlplus script?
    I would have loved to give you an example..but its not unix on my laptop.
    But what i can tell you is...u should be doing otherway round.
    Not calling Unix commands from SQL but calling SQL's form unix.
    You got shell scripts for that.
    Write a shell script. Login to SQL execute your code.
    exit from sql and then move your file with MV. That's it.
    Do post how far you get after trying this.

  • Call an interactive UNIX command from java

    Hi,
    I want to call a UNIX command from java. When issue the command 'htpasswd -c filename username' on UNIX terminal, it asks for the new password and the then confirmation password again (yeah, unfortunately the htpasswd installed on our system does not allow you proivde the password on the command line. So have to work interactively ). Now, I have written a simple java program RunCommand.java. I am hardcoding the password for the htpasswd command in the file (in the real situation, password will be generated dynamically). I want to issue 'java RunCommand' on the UNIX command line and get back the command prompt without being asked for the password twice. The code is below, but the Outputstream does not work as expected. It always asks for inputs. Any idea? Many thanks.
    import java.io.*;
    public class RunCommand {
    public static void main(String args[]) throws Exception {
    String s = null;
    try {
    String cmd = "htpasswd -c filename username ";
    // run a Unix command
    Process p = Runtime.getRuntime().exec(cmd);
    BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
    BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
    OutputStream stdOut = p.getOutputStream();
    String pswd = "mypassword";
    while ((s = stdInput.readLine()) != null) {
         s = stdInput.readLine();
         stdOut.write(pswd.getBytes());          
         stdOut.flush();
    System.out.println("Here is the standard error of the command (if any):\n");
    while ((s = stdError.readLine()) != null) {
    System.out.println(s);
    stdOut.close();
    stdInput.close();
    stdError.close();
    System.exit(0);
    catch (IOException e) {
    System.out.println("exceptions caught: ");
    e.printStackTrace();
    System.exit(-1);

    There are only about 9 billion responses a day on how to do this. Use the search feature.

  • Calling UNIX command from PL/SQL Procedure

    Is there a way to call a UNIX command (exa. ls) from within a PL/SQL stored procedure? Looking through the various packages, I didn't see anything that would give me this ability.
    I also looked through all the previous questions and nothing looked encouraging.
    Thanks in advance,
    Russ

    Russ,
    I thought I'd read a similar question awhile ago and did a search on the word host in this forum and found the following from July 9th that might help you:
    http://technet.oracle.com:89/ubb/Forum88/HTML/001611.html
    In that post I think the link listed by Barbara Boehmer in has changed to:
    ]http://asktom.oracle.com/pls/ask/f?p=4950:8:24579::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:16212348050,{host}
    It looks like they give solutions for Oracle 7, 8 and 8i.
    Good site Barbara, I've added it to my bookmarks.
    Hope this helps.

  • I want to execute UNIX COMMAND in ABAP

    Hi All,
    I want to execute a UNIX XOMMAND sh <scriptname> <filename> to replace divsion codes.in ABAP.
    But, I came to know that we can't (2) or try the following program but unfortunately the command CALL SYSTEM is not supported by SAP. If you are on R/3 2.1 - 2.2x you can get some idea's from the program SAPMSOS0.
    REPORT ZUNIXCOM .
    DATA: U_COMMAND(200).
    Table for system messages
    DATA: BEGIN OF RT OCCURS 100 ,
    LINE(100) ,
    END OF RT .
    START-OF-SELECTION .
    MOVE 'unix command' to U_COMMAND .
    REFRESH RT.
    CALL 'SYSTEM' ID 'COMMAND' FIELD U_COMMAND
    ID 'TAB' FIELD RT-SYS .
    LOOP AT RT.
    WRITE : / RT-LINE .
    ENDLOOP. 
    So please can u help me how to call a unix command from ABAP. it is very urgent. I want complete details and all possible solutions
    <removed_by_moderator>
    Thanks,
    gyanaraj
    Edited by: Julius Bussche on Aug 26, 2008 11:29 AM

    Selvaraj Gyanaraj wrote:>
    > So please can u help me how to call a unix command from ABAP.
    I was about to help you.
    >it is very urgent.
    I changed my mind.
    >I want complete details and all possible solutions
    I'm glad I changed my mind.
    >Points are surely rewarded.
    Too late.

  • Unix command from pl/sql

    How can I call a unix command or run a c program
    from a stored procedure in oracle 9i.

    Or if you want to do a host call then implement the following class as a Java stored procedure.
    import oracle.jdbc.*;
    public class util
    // Executes an operating system command. The command shall be fully qualified.
    // The Java connects with silent login. No environment set-up files are run
    // and no path is set. The mode can be "sync" or "async" for respectively
    // synchronous and asynchronous execution
    static public int OSCmd(String cmd, String mode, String[] output)
    throws IOException, InterruptedException
    System.out.println("OSCmd "+cmd+" ("+mode+")");
    output[0]="";
    // start command
    Process proc = Runtime.getRuntime().exec(cmd);
    if (mode.equals("sync"))
    // get command's stdout and stderr
    InputStream stdout = proc.getInputStream();
    InputStream stderr = proc.getErrorStream();
    String str;
    // Stdout
    BufferedReader br = new BufferedReader(new InputStreamReader(stdout));
    while ((str = br.readLine()) != null)
    output[0]+=str+"\n";
    br.close();
    // Stderr
    br = new BufferedReader(new InputStreamReader(stderr));
    while ((str = br.readLine()) != null)
    output[0]+=str+Long postings are being truncated to ~1 kB at this time.

  • Unix command question on TAB content

    We found the following ABAP statemenet
    DATA: our_unix_path_and_file_name(64) TYPE c,
               v_unixcmd(255) TYPE c,
               result(255) TYPE c OCCURS 100 WITH HEADER LINE.
    CONCATENATE 'ls -al' our_unix_path_and_file_name INTO v_unixcmd SEPARATED BY space.
    CALL 'SYSTEM' ID 'COMMAND' FIELD v_unixcmd
                    ID 'TAB'     FIELD result-*sys*.
    The question is: is result an internal table? if it's an internal table, then why it's defined as type c?  And also what is included in this result after calling this UNIX command? it will list all the file content?
    Thanks and we will give you reward points!

    Hi,
    The result you'll get is a list of files and attributes from a directory and it will be placed in an internal table.
    Regards,
    Nicolas.

  • Run Unix command / Run Unix shell script from Forms9i

    Hi,
    I have a requirement to run Unix command and Unix shell scripts from Forms9i.
    I know HOST command cannot be used directly. I also know we can create some JAVA stored procedure to perform the task, but I don't want to create any JAVA stored procedure as there are some security concerns.
    Please point me towards any other way to achieve the same.
    I would really appreciate your help.
    Thanks,
    Kumar

    There is no reason why HOST can't be used. This is what it is for. As for using Java, it is not a stored procedure that you would be using, it would be imported Java (imported into the form).
    The best way to use the HOST command is to call a script (.sh) rather than calling a Unix command directly. This is because HOST will not pick up environment variables set at the system level. So the script would first need to set the necessary environment variables then call the desired commands.

  • Shortdump while calling UNIX command

    Hi all,
    I have a problem while trying to remove a file in UNIX platform in ABAP program.
    It is working fine in the development and quality server, but not in production server.
    Based on the debug result, the shortdump was thrown while executing "CALL 'SYSTEM' ID 'COMMAND' FIELD lv_command".
    Below are the message return in the program shortdump
    How to correct the error                                  
        You can check the authorization beforehand with the   
        function module AUTHORITY_CHECK_C_FUNCTION.           
    Short text                                            
        No authorization to call the C function "SYSTEM". 
    DATA: lv_command(100) TYPE C,
            client_path LIKE RCGFILETR-FTAPPL,
            server_path LIKE RCGFILETR-FTAPPL.
      DATA: wa_files  TYPE rsfillst,
            it_files  LIKE TABLE OF wa_files.
      CALL FUNCTION 'SUBST_GET_FILE_LIST'
        EXPORTING
          dirname      = gv_unix
          filenm       = '*'
        TABLES
          file_list    = it_files
        EXCEPTIONS
          access_error = 1
          OTHERS       = 2.
      IF  sy-subrc = 0.
        LOOP AT it_files INTO wa_files WHERE TYPE <> 'directory'.
          CONCATENATE wa_files-dirname wa_files-name INTO server_path.
          CONCATENATE p_fname wa_files-name          INTO client_path.
          CALL FUNCTION 'C13Z_FILE_DOWNLOAD_ASCII'
            EXPORTING
              i_file_front_end    = client_path
              i_file_appl         = server_path
              I_FILE_OVERWRITE    = 'X'
            EXCEPTIONS
              FE_FILE_OPEN_ERROR  = 1
              FE_FILE_EXISTS      = 2
              FE_FILE_WRITE_ERROR = 3
              AP_NO_AUTHORITY     = 4
              AP_FILE_OPEN_ERROR  = 5
              AP_FILE_EMPTY       = 6
            OTHERS                = 7.
          IF sy-subrc = 0.
            concatenate 'rm -f' server_path into lv_command separated by space.
            condense lv_command.
            CALL 'SYSTEM' ID 'COMMAND' FIELD lv_command.
            CLEAR: lv_command.
          ENDIF.
        ENDLOOP.
      ENDIF.
    Anyone knows why and how to resolve this?
    Kindly provide your feedback and input. Thanks in advance.

    You don't have authorisation in PRD to remove files. If it is really required for you.
    Take SU53 screen shot  immediately once you get short dump and follow up with Basis Folks for required authorisation.
    Thanks,
    Raj

  • Call Unix Command From Reports Using Java

    Hi,
    Could somebody please show me a sample coding to call Unix command from 10g report using java?
    In metalink doc id 361857.1 does not show much.
    Thanks,
    neemin

    Hi,
    I have a problem with synchronization of the java commands.
    In the Before Parammeter Form trigger, I have:
    function BeforePForm return boolean is
    rt ORA_JAVA.JOBJECT;
    proc ORA_JAVA.JOBJECT;
    v_txt varchar2(32000);
    i integer := 0;
    v_cd_modulo int;
    v_arqlog text_io.file_type;
    cursor c_evento is
    select codigo,
    nome
    from
    (select e.cd_evento || e.cd_edicao codigo
    ,nm_evento nome
    from grh_ev_evento e
    where e.CD_GRUPO in (select cd_grupo
    from grh_ev_adm
    where cd_usuario = (select cd_usuario
    from usuario
    where login_usuario = :AUTHID)))
    order by substr(nome, 11);
    begin
    -- Create the context for logged user
    if instr(upper(nvl(:AUTHID,'RWCLIENT')),'RWCLIENT') > 0 then
    :AUTHID := :SSO_USUARIO;
    end if ;
    TCEENV.SET_TCEENV(:AUTHID);
    if PK_SCA.SCA_GET_USER_RIGHTS(:sca_module_name, :AUTHID) IS NULL then
    srw.message(100, 'Access denided!');
    return (FALSE);
    end if;
    -- Create file in Report Server (UNIX)
    v_txt := '<BR>' || htf.formSelectOpen('P_EV_EDICAO', 'Evento: ');
    :p_file := '/u03/SCAWEB/repout/' || :sca_module_name || '_' ||
    pk_sca.sca_encrypt(:AUTHID || to_char(systimestamp, 'ss.ff'));
    v_arqlog := text_io.fopen (:p_file, 'A');
    text_io.put_line (v_arqlog, v_txt);
    for reg in c_evento loop
    i := i + 1;
    if i = 1 then
    v_txt := '<OPTION SELECTED VALUE="' || reg.codigo || '">' || reg.nome;
    else
    v_txt := '<OPTION VALUE="' || reg.codigo || '">' || reg.nome;
    end if;
    text_io.put_line (v_arqlog, v_txt);
    end loop;
    v_txt := '</SELECT></CENTER></form></BODY> </HTML>';
    text_io.put_line (v_arqlog, v_txt);
    text_io.fclose (v_arqlog);
    SRW.SET_AFTER_FORM_HTML(SRW.FILE_ESCAPE, :p_file);
    rt := RUNTIME.GetRuntime();
    proc := RUNTIME.exec(rt,'rm ' || :p_file);
    return (TRUE);
    end;
    The problem is that there isn't a "synchronize" command, and the
    RUNTIME.exec(rt,'rm ' || :p_file) don't works (it does nothing) because
    the SRW.SET_AFTER_FORM_HTML has a large delay and the following
    command is ignored.
    How can I solve it?
    thanks,
    lmprestes

Maybe you are looking for

  • BSOD ha20x2k.sys.. help from

    IRQ_LESS_OR_EQUAL that happened after playing starship troopers for a while.... i got latest firmware and drivers for everything.. AMD Athlon 64 X2 4400++ABIT Fatalty AN8-SLI2x XFX 7800GTX Extreme Gamers Edition in SLISound Blaster X-FI Fatalty FPSOC

  • Unable to update pricing in open sales orders

    Dear All I had created some sales orders which are partially delivered, now i need to update one of the pricing component due to change in that component (i have already created new pricing component thru VK11) but when i try to change (VA02) sales o

  • What happens at each step of an iPhone Backup and Sync?

    Can someone tell me exact what is happening at each step of an iPhone backup and sync? I see 5 to 7 steps. So what has happened after step 1, then after step 2, and so forth? I would appreciate if only those who knows exactly what happens will list i

  • Can't get EPSON nx300 to work with airport express

    hey yall i'm running a 3 year old white 13" macbook with 10.5.7 osx installed -~- having trouble getting things to print via my new airport express. my boyfriend has no troubles with his brand new macbook pro - it just worked instantly for him. my co

  • I deleted Dictionary, How do I get it Back?

    I moved Dictionary from the app folder to the desktop, then decided I didn't want Dictionary on the desktop anymore so I deleted it thinking that it was just a shortcut or alias and that the original would still be in the Applications Folder. How Can