Running Shell Script from

Dear Friends!
         I have one requirement, I have to trigger Unix Shell script from ABAP program.   but only twist in the story is my SAP box is not in Unix system so I cant use external command execute function module.  Is any one come accross to such scenario ? Please advice on this that How we can do this task.
I have one idea like
I can make shell script from ABAP put into FTP directory of Unix using webservice and schedule the background job or something in UNIX so after some time it get executed but not sure on this. if we can achieve this in real time it will be really cool compare to background job or something.
Please give me your expert advices. Any help from you will be greatly appreciated.
Thanking you and Regards
Naeem

I use PI for this.

Similar Messages

  • Running shell scripts from within oracle. A big task is forgotten

    Dear List,
    I have some shell shell scripts which do some tasks on the linux OS level.
    I am calling the Korn scripts using a java class, which in turn is being called from a PLSQL function.
    All but one of the 10 script works fine. This is the script which does the most work, and takes on average 40 minutes usually.
    Why does Oracle forget the running of the shell script? I wait in my PLSQL function for the return code, but it never comes. The scripts I have not written myself !
    I look forward to your reply on this matter.
    regards
    Ben

    Hi
    If you are using the Oracle database 10g, the new dbms_scheduler package allows you to run shell scripts. The dbms_scheduler.create_job procedure have one parameter called the job_action in which you specify the full path of the shell script.
    I hope this will help

  • Run shell script from plsql

    You can use utl_tcp to do http posting, send email, and ftp files. Has anyone ever executed a unix shell script from plsql on a remote unix box?

    I am actually asking about running a script file on a remote machine, not on the host. A java procedure or c file extproc call could be used to call a host script file.
    A key limitation of this java procedure method is shown in the ask tom reference:
    if you can do it from sever A on the command line (outside of oracle), we can do
    it inside the database.
    Solve that problem and we'll go from there. Oracle cannot bypass the OS and do
    magical things beyond what you've set up at the OS level.
    since utl.tcp opens a tcp connection, can you open a telnet session using utl_tcp and low level command formatting? I didnt have much trouble creating a plsql based ftp client, has anyone seen a plsql based telnet client?

  • Run Shell script from oracle plsql

    OS--> Linux
    Version--Oracle 10g
    I want to run a shell script from oracle PL/sql. I know dbms_scheduler can be used to create job , enable job and run it .
    But I have a requirement where I need to know if my script ran successfully or not. Something like a return code back to oracle.
    So that I can run appropriate code depending on return code of executed Script.
    Kindly help !!

    Online documentation was invented for a reason.
    And this reason was not would look it, as a volunteer, on your behalf, and post it in this forum.
    All procedures are documented. There are examples for most facitlities on Asktom, and there is Morgan's Library at [http://www.psoug.org]
    Sybrand Bakker
    Senior Oracle DBA

  • Running shell script from terminal

    If I run this shell script from the terminal it plays the sound though my external speakers;
    volume="/Volumes/8GIGSTICK"
    if mount|grep $volume; then
    afplay -d /System/Library/Sounds/insert.wav
    rsync -a /volumes/8GIGSTICK/documents /Users/mcp/Documents/Microsoft\ User\ Data/
    else
    say not mounted
    fi
    If I have launchd run it when the volumes is mounted it only plays the sound through the internal computer speaker.
    Anyone know why and how I can fix it?

    It's probably because your launchd job isn't running in the Aqua context and therefore doesn't pick up your sound-output preferences. One way to overcome this would be to load the job as follows:
    launchctl load -S Aqua -D user job_label
    That's assuming you have a launchd property list at ~/Library/LaunchAgents/job_label.plist. To make the effect persist across login sessions, you would create a file ~/.launchd.conf with the contents
    load -S Aqua -D user job_label

  • Running shell scripts from GUI

    I'm trying to run a simple shell script (bash or sh) from the GUI (just double click it).
    I've managed to run it by double clicking, BUT, it runs from my home directory (even if i add --noprofile or remove #!/bin/bash line completely).
    How can I keep the current directory, or at least get it as a variable?
    Thanks,

    Hi
    If you are using the Oracle database 10g, the new dbms_scheduler package allows you to run shell scripts. The dbms_scheduler.create_job procedure have one parameter called the job_action in which you specify the full path of the shell script.
    I hope this will help

  • Running Shell script from command line

    Hi,
    I am getting a Exception in thread "main" java.lang.NoClassDefFoundError: TestRuntime/java error when I run the following code on my linnux box...can anyone please help
    import java.io.*;
    public class TestRuntime {
            public static void main(String args[]) {
                    Runtime runtime = Runtime.getRuntime(); //get runtime information
            try {
                            Process Child = runtime.exec("/usr/bin/ksh"); // execute command
                            BufferedWriter outCommand = new BufferedWriter(new OutputStreamWriter(Child.getOutputStream()));
                            outCommand.write("/home/mypath/tesh.csh");
                            outCommand.flush();
                            try {
                                    Child.waitFor(); // wait for command to complete
                            } catch (InterruptedException e) { // handle waitFor failure
                                    System.out.println("ERROR: waitFor failure");
                                    System.exit(10); // exit application with exit code 10
                    } catch (IOException e) { // handle exec failure
                            System.out.println("ERROR: exec failure" + e);
                            System.exit(11); // exit application with exit code 11
    }

    If I'm reading your code correctly, you're starting a Korn shell session, then executing your C shell script as if you were at at the session window's prompt. If that is correct, you haven't caused your standard out (stdout) to hit ENTER yet. I'm not an expert, but I hope this works for you.
    Your code:
    Process Child = runtime.exec("/usr/bin/ksh"); // execute command
                            BufferedWriter outCommand = new BufferedWriter(new OutputStreamWriter(Child.getOutputStream()));
                            outCommand.write("/home/mypath/tesh.csh");
                            outCommand.flush();I think you need to enter one extra line before the flush():
    Process Child = runtime.exec("/usr/bin/ksh"); // execute command
                            BufferedWriter outCommand = new BufferedWriter(new OutputStreamWriter(Child.getOutputStream()));
                            outCommand.write("/home/mypath/tesh.csh");
                            outCommand.newLine();  // hit ENTER
                            outCommand.flush();P.S. If you're running this script and your Java program from the same UNIX machine, you could just execute the shell script inside the runtime.exec() call.

  • Running Shell scripts from the desktop

    Hi,
    I'm from the UNIX world rather than the mac one so have written a number of shell scripts. Lets call them foo.sh and bar.bash for the sake of argument.
    These are sitting in a folder on my desktop
    I can happily open a terminal session and run the scripts - and they work as I expect them to.
    If I open a Finder window and double click on the icons for the scripts what happens is that it opens TextEdit.
    Theres two things I'd like to change
    A. I'd like to change the behaviour so that the scripts run when I double clike them rather than opening an editor (possibly in a terminal window )
    B. I'd like to be able to change the editor from TextEdit to one I'm more used to...(I've installed Vim/Gvim which I quite like).
    A. - Haven't managed to get anywhere trying to solve this....
    B. - So far my attempts have got as far as...
    1...
    right-click -> open with -> Other -> select vim.app
    tick Always open as
    click open
    The file then opens in a vim window.
    however if I now close the vim application and double clike the file icon then the file opens in TextEdit again
    2...
    Right Click -> Get Info -> Open with VIM -> add -> Change all
    message appears
    'Are you sure you want to change all your Vimm.app documents to open with the application "vim.app"
    This change will apply to all Vim.app documents with extension ".sh" '
    click continue
    In the Info pane the 'Open with' selection widget immediately changes to say 'Open with: TextEdit.app'
    So I'm a bit stumped, can you help!
    Regards
    Mark
    Mac Mini   Mac OS X (10.4.3)  

    Thanks to both people who answered.
    You both gave me useful workarounds to my problem.
    Renaming the scripts to be 'foo.command' was very hepful and useful to know. I tried this and it does indeed work. I may use this in the future.
    I also had a play around with applescript and the automator to achieve similar results.
    I agree that double clicking to run the file and also edit it is mutually exlcusive - I'm sort of trying to work out how I could make it do 'either/or' as I choose. In the Windows world i'd have the option of setting 'open' to run the script (assuming I'd got cygwin installed and had assiciated it) OR 'Edit with vim' if I wanted to edit the file (assuming vim was installed!).
    Unresolved issue is that I'm still unable to get VIM to be associated with a .sh file.
    The way I would envisage it working in Mac world would be to be able to right click on foo.sh -> Open with... and have a list to select from immediately there like..
    Text Edit
    Vim
    Terminal (default)
    and be able to somehow add and remove apps from the list and change which is the default.
    My issue is that I don't seem to know how to get other apps than TextEdit to appear in the list - I suspect I need a better understanding of how these file/application associations work and are configured.
    Regards
    Mark

  • Running Shell Script from another server

    Hi,
    I have a shell job in QA server. Is there any way to run this shell job from another linux server.
    Thanks,

    you can execute it remote with ssh
    ssh serverb /path/to/script.sh
    this executes the script on the remote server (serverb) not local!

  • How I run a shell script from the scheduler on 10.2.0.2.0 ?

    Hello Oracle People,
    I'd like to run a shell script from the Scheduler in my 10g database.
    Right now it is a simple shell script.
    Eventually it will wrap RMAN commands to back up my DB.
    I wrote a simple pl/sql script to create a job:
    -- cr_job10.sql
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
    job_name => 'my_backup_job',
    job_type => 'EXECUTABLE',
    job_action => '/h/oracle/scripts/tst.sh',
    start_date => '06-SEP-07 5.33.00PM US/Pacific',
    repeat_interval => 'FREQ=DAILY',
    end_date => '08-SEP-07 4.00.00PM US/Pacific',
    enabled => TRUE,
    comments => 'My Backup Job');
    END;
    I see no errors when I run the above procedure.
    I checked DBA_SCHEDULER_JOBS and the job is in there.
    The scheduler, though, errors out with an error which I see in a trace file:
    /h/oracle/admin/orcl/bdump/orcl_j000_22396.trc
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    ORACLE_HOME = /h/oracle/product/10r2
    System name: SunOS
    Node name: sol
    Release: 5.10
    Version: Generic_118855-14
    Machine: i86pc
    Instance name: orcl
    Redo thread mounted by this instance: 1
    Oracle process number: 15
    Unix process pid: 22396, image: oracle@sol (J000)
    *** ACTION NAME:(MY_BACKUP_JOB) 2007-09-06 17:33:00.175
    *** MODULE NAME:(DBMS_SCHEDULER) 2007-09-06 17:33:00.175
    *** SERVICE NAME:(SYS$USERS) 2007-09-06 17:33:00.175
    *** CLIENT ID:() 2007-09-06 17:33:00.175
    *** SESSION ID:(140.13520) 2007-09-06 17:33:00.175
    *** 2007-09-06 17:33:00.175
    ORA-12012: error on auto execute of job 53267
    ORA-27369: job of type EXECUTABLE failed with exit code: 274662
    I googled on this:
    ORA-27369: job of type EXECUTABLE failed with exit code: 274662
    Google returned only 1 hit.
    There, I see some evidence that I need to configure something inside
    of Oracle to run shell scripts from the scheduler, but possibly just
    for machines running windows. I'm running Solaris.
    Do any of you know what I need to configure inside of Oracle to
    run shell scripts from the scheduler?
    -Owen

    Hello people,
    I should have added this bit of information:
    "The script runs fine from oracle's crontab."
    "The script runs fine from a shell owned by oracle."
    I'm getting responses telling me to check my env variables and permissions
    which would be helpful to a UNIX novice.
    I have a feeling that no one is using the scheduler to run RMAN scripts.
    Tim Hall suggested I take a close look at these files:
    $ORACLE_HOME/rdbms/admin/externaljob.ora
    $ORACLE_HOME/bin/extJob
    Currently I'm setup like this:
    bash sol root /h/oracle/product/10r2/bin 31 #
    bash sol root /h/oracle/product/10r2/bin 31 # ll $ORACLE_HOME/rdbms/admin/externaljob.ora
    -rw-r--r-- 1 root dba 52 Sep 7 15:29 /h/oracle/product/10r2/rdbms/admin/externaljob.ora
    bash sol root /h/oracle/product/10r2/bin 32 #
    bash sol root /h/oracle/product/10r2/bin 32 # cat $ORACLE_HOME/rdbms/admin/externaljob.ora
    # externaljob.ora
    run_user = rman
    run_group = rman
    bash sol root /h/oracle/product/10r2/bin 33 #
    bash sol root /h/oracle/product/10r2/bin 33 #
    bash sol root /h/oracle/product/10r2/bin 33 #
    bash sol root /h/oracle/product/10r2/bin 33 # ll $ORACLE_HOME/bin/ext*
    -rwsr-x--- 1 rman dba 30388 Sep 21 2006 /h/oracle/product/10r2/bin/extjob*
    -rwsr-x--- 1 rman dba 30392 Sep 21 2006 /h/oracle/product/10r2/bin/extjobo*
    -rwsr-x--- 1 rman dba 34468 Sep 21 2006 /h/oracle/product/10r2/bin/extproc*
    -rwxr-xr-x 1 oracle dba 300 Sep 21 2006 /h/oracle/product/10r2/bin/extusrupgrade*
    bash sol root /h/oracle/product/10r2/bin 34 #
    bash sol root /h/oracle/product/10r2/bin 34 #
    bash sol root /h/oracle/product/10r2/bin 34 #
    On my system, the user 'nobody' has no shell so I cannot use nobody.
    I created a user named rman:
    bash sol root /h/oracle/product/10r2/bin 34 #
    bash sol root /h/oracle/product/10r2/bin 34 #
    bash sol root /h/oracle/product/10r2/bin 34 # su - rman
    Sun Microsystems Inc. SunOS 5.10 Generic January 2005
    $
    $ id
    uid=220(rman) gid=220(rman)
    $
    $
    $ date
    Fri Sep 7 16:30:03 PDT 2007
    $
    $
    Jared points out that rman needs access to extproc:
    $ ls -la /h/oracle/product/10r2/bin/extproc
    -rwsr-x--- 1 rman dba 34468 Sep 21 2006 /h/oracle/product/10r2/bin/extproc
    $
    $
    Here is a demo of rman running his script:
    bash sol root /h/oracle/product/10r2/bin 35 # su - rman
    Sun Microsystems Inc. SunOS 5.10 Generic January 2005
    $
    $
    $ ls
    scripts
    $
    $
    $ scripts/tst.sh
    $
    $
    $ cat scripts/tst.sh
    #! /bin/sh
    /usr/bin/date > /tmp/tst.sh.out.txt 2>&1 &
    exit 0
    $
    $
    $ cat /tmp/tst.sh.out.txt
    Fri Sep 7 16:31:23 PDT 2007
    $
    $ rm /tmp/tst.sh.out.txt
    $
    I am focused on this error:
    ORA-27369: job of type EXECUTABLE failed with exit code: 274662
    And I am focused on this exit code: 274662
    What does 274662 mean?
    If the Scheduler gives me an error like "274662" rather than some English,
    it's obvious to me the Scheduler is a POS and I should not use it.
    And of course,
    If I cannot run RMAN from Oracle Scheduler, I'll use cron.
    -Owen

  • Run shell script as sudo user without giving sudo passowrd from normal usr

    Hi ,
    i am running shell script from my account with sudo user what is the problem in my procedure.
    Please if any thing wrong in my procedureprocedure or any permission required please let me know.
    here is the my procedure and sudo permissions.
    [techm@ppsol04 ~]$ sudo su - dadm sudo -u dadm /u01/ora/tools/Dbmon/scripts/export.sh
    Sorry, user techm is not allowed to execute '/u01/ora/tools/Dbmon/scripts/export.sh' as dadm on ppsol04.
    [dchandu@ppsol04 ~]$ sudo -l
    Matching Defaults entries for techm on this host:
    env_keep=SSH_AUTH_SOCK, !authenticate, env_reset, always_set_home, !requiretty
    sudo permissions :
    sudo -l
    Matching Defaults entries for techm on this host:
    env_keep=SSH_AUTH_SOCK, !authenticate, env_reset, always_set_home, !requiretty
    User techm may run the following commands on this host:
    (ALL) NOPASSWD: /local/bin/hardened_profile.sh
    (root) NOPASSWD: /bin/su - dora
    (root) NOPASSWD: /bin/su - doraadm
    (root) NOPASSWD: /bin/su - docenter
    (root) NOPASSWD: /bin/su - tora
    (root) NOPASSWD: /bin/su - toraadm
    (root) NOPASSWD: /bin/su - tocenter
    (root) NOPASSWD: /bin/su - hora
    (root) NOPASSWD: /bin/su - horaadm
    (root) NOPASSWD: /bin/su - hocenter
    (root) NOPASSWD: /bin/su - agcfdwf4
    (root) NOPASSWD: /bin/su - pora
    (root) NOPASSWD: /bin/su - dadm
    (root) NOPASSWD: /bin/su - pocenter
    (root) NOPASSWD: /bin/su - agcfdwp4
    Thanks
    tech

    Can you please explain what you are trying to accomplish?
    To my understanding there is no such thing like a sudo password for a normal user. Sudo allows users to become root based on a sudo list (suoders). The user is then prompted for their own account password to run as super-user or root.

  • 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.

  • How to run a shell script from the GUI?

    This is probably a dumb question...
    How do I run a shell script from the GUI? I've been told to double click it but when I do, it opens as a text file.

    The behavior you describe is that used by the KDE and GNOME desktops of Linux.
    Under OS X, if you make a script then mark it as executable, double-clicking on it in the Finder will not execute it. Actually, it uses a rather complex algorithm ([summarized here|http://arstechnica.com/reviews/2q00/macos-qna/macos-x-qa-2.html]) to determine what to do with it. This is implemented in Mac OS X' LaunchServices framework (incidentally, the associations are cached in /Library/Caches/com.apple.LaunchServices*.csstore and ~/Library/Caches/com.apple/LaunchServices*.csstore). You can read the details in the developer docs about LaunchServices.
    Anyway, in short, the suffix '.command' is a built-in type in the LaunchServices network that identifies a shell script. If you run
    /System/Library/Frameworks/ApplicationServices.framework/Frameworks/LaunchServic es.framework/Support/lsregister -dump
    ... it will tell you as much.

  • 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.

  • Output from Run Shell Script action

    Does anyone know what happens to the output of a "Run Shell Script" Automator action if there are no further actions? Does it simply get discarded, or does it end up in a log somewhere?

    It's the same for any action, nothing.
    The results passed on to the next action is generally just a list of file paths, or perhaps some text, or maybe a reference to a single item. In the "Run Shell Script" case, the result would likely simply be some text, perhaps as a list of lines.
    So, if there are no more actions, any of those results are just dropped.
    However, a list of files (or whatever) is actually just part of the results. An action performs some task on the input, or on the results from a previous action. In a sense, there can be said to be two parts to the "results". For example, perhaps an action changes some photos to black & white, so the photos will have been changed and then the paths to the photos (list of items) will be passed to the next action. The list of items is the only usable part for the next action, if there is a next action.
    You can use Automator's "View Results" action after it to see the results, TextEdit's "New Text File" to create a file with the previous results as the contents, TextEdit's "New TextEdit Document" to open a new document with the results as the document's contents, and so on.

Maybe you are looking for