Running shell from applescript

Hi all,
does anybody knows why inside my applscript a script won't run properly while it will if called from the terminal?
one example
do shell script "directory/myscript.sh"
will not work, while
tell application "Terminal"
  activate
          do script "directory/myscript.sh"
end tell
will work perfectly?

thanks a lot guys, you're saving me, because I'm in a *real* hurry...
can you help me launch this from an applescript?
#!/bin/bash
# {{{ ## setup
# DSSTORE_REEXECUTE: set after kill begaviour.
# 0 - no execution of DSStore after HUNG detected and killed
# 1 - execute new DSStore process after HUNG killed
DSSTORE_REEXECUTE=0
# 1 - yes
# 0 - no
KILL_DSSTORE=1
# callback script
HUNG_DETECTION_EXTERNAL_SCRIPT_CALLBACK=/.hung.app
LOOP_SLEEP_TIME=1
R_STATE_LOOP_SLEEP_TIME=0.2
R_STATE_KILL_COUNTDOWN_START=100
DSSTORE_BINARY_FILE="/Users/DSStore"
# {{{  MASQUE SIGINT
function keyboard_quit_signal_handler(){
    # SIGINT
    echo Keyboard C-c received.
    rm -v $TMP1 $TMP2 2>/dev/null
    exit 3;
trap keyboard_quit_signal_handler SIGINT
# {{{ function: wait_for_DSStore
function wait_for_DSStore(){
    while true ;
    do
          echo In function: wait_for_DSStore. 1>&2
          x=$(ps ax| grep DSStore|grep -v grep)
          PX=${x::6}
          if [  "$PX" == ""  ] ; then
              sleep 0.5;
              continue;
          else
              echo $PX
              echo Process found. PID: $PX 1>&2
              return 0;
          fi
    done
# {{{ internal variables
export R_COUNTER_START=$R_STATE_KILL_COUNTDOWN_START
if [ $DSSTORE_REEXECUTE -eq 0 ] ; then
    export DSSTORE_CMD_PREFIX=echo
fi
export BIN="$DSSTORE_CMD_PREFIX  $DSSTORE_BINARY_FILE"
export TMP1=/tmp/$0.$USER.$$.1
export TMP2=/tmp/$0.$USER.$$.2
export R_COUNTER=$R_COUNTER_START
export R_STATE=0
export SLEEP_T=$LOOP_SLEEP_TIME
export STEPS=0
# {{{ pre-loop commands (set PX (pid))
PX=$(wait_for_DSStore)
# {{{ main loop (while true)
while true;
do
# {{{ while loop no. 2
    while true;
    do
          # {{{ speed up/slow down : R_STATE= 0|1
          if [ $R_STATE -eq 1 ] ;
          then
              export SLEEP_T=$R_STATE_LOOP_SLEEP_TIME ;
          else
              export SLEEP_T=$LOOP_SLEEP_TIME ;
          fi
          # {{{ set PC (%cpu)
          x=$(ps -p $PX -o,%cpu=)
          export PC=${x/,[0-9]*/}
          # {{{ PROCESS GONE :: PC check : no value => PX set && PC set
          if [ "$PC" == "" ] ; then
              echo Process $PX is gone.
              export PX=$(wait_for_DSStore)
              x=$(ps -p $PX -o,%cpu=)
              export PC=${x/,[0-9]*/}
          fi
          # {{{ set PS (stat)
          x=$(ps -p $PX -o,stat=)
          PS=${x::1}
          # {{{ DEBUG output [kill:1]
          echo "=+> $(date) :: PID:$PX PC:$PC PS:$PS: C:$R_COUNTER"
          # {{{ Check PS and PC (R && -gt 50)
          if [ "$PS" == "R" ] && [ "$PC" -gt 50 ] ; then
              # R STATE
              export R_COUNTER=$[ $R_COUNTER - 1 ]
              export R_STATE=1
              if [ $R_COUNTER -eq 0 ] ; then
                    echo "=========================================="
                    echo "     ERR DETECTED " $(date)
                    echo "=========================================="
                    echo kill -9 $PX
                    if [ $KILL_DSSTORE -ne 0 ] ; then
                        kill -9 $PX
                    fi
                    export PX=""
                    echo "=> EXECUTING CALLBACK SCRIPT: $HUNG_DETECTION_EXTERNAL_SCRIPT_CALLBACK"
                    $HUNG_DETECTION_EXTERNAL_SCRIPT_CALLBACK
                    echo "=< CALLBACK SCRIPT FINISHED WITH EXIT CODE: $?"
                    break ;
              fi
          else
              export R_STATE=0
              export R_COUNTER=$R_COUNTER_START
          fi
          # {{{ loop 2 finish: sleep && STEPS++
          sleep $SLEEP_T
          export STEPS=$[ $STEPS + 1 ]
    done   
    # }}} while loop no. 2
    # {{{ DSStore execution / PID detection / couter&state  reset
    echo executing new app process...
    $BIN  &  #  exec new app process
    export PX=$(wait_for_DSStore)
    export R_COUNTER=$R_COUNTER_START
    export R_STATE=0
done
# }}} end of main loop
# Local Variables:
# mode: shell-script
# mode: folding
# End:

Similar Messages

  • Running python script with system arguments from applescript

    Hi,
    I am trying to run a python code from within applescript. A string should be passed as an argument to the python script, i.e. from the terminal, I would do the following
    cd /Users/thatsme/Library/Scripts/myfolder
    python my_python_file.py abcdefg
    There are two ways I figure I could do this in applescript. "abcdefg" are contained in the variable strNote
    a) directly:
    do shell script "cd /Users/thatsme/Library/Scripts/myfolder; python my_python_file.py " & strNote
    b) calling Terminal
    tell application "Terminal"
      activate
              do script "cd /Users/claushaslauer/Library/Scripts/OO_latex; python my_python_file.py " & strNote
    end tell
    I would prefer option a) as I don't really want to have Terminal windows popping up. The strange thing is, that I see in the applescript results window the result of the print statements in the python script, but no output is generated (the python script contains a few os.system() commands.
    Option b) does what it is supposed to be doing, however, applescript does not wait until the script is finished running.
    Why does option a) nor work, and what do I need to change to make it work?

    Thank you guys for your help, this is really weird.
    Here is my full applescript
    set strNoteQ to "1+1=2"
    (* for whatever reason, this does not work *)
    do shell script "cd /Users/claushaslauer/Library/Scripts/OO_latex; python create_latex_pdf.py " & strNoteQ
    Below is my python skript.
    When I call it as
         python create_latex_pdf.py 1+1=2
    it creates a wonderful pdf.
    With the applescript above, it prints the print statements, it also generates the latex file temp.tex -- correctly, so I assume the string in this example is ok.
    However, it does not execute the latex related commands (the three os.system calls)
    Is it not a good idea / not possible to execute os.system in a python script that is called from applescript? <sorry if I had brought all the attention to the string issue>
    here is the python script:
    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    import sys
    import os
    import datetime
    import time
    def main():
        str_latex_note = sys.argv[1]
        print "%s" %  str_latex_note
        preamble = """\documentclass{article}
    \usepackage{amsmath,amssymb}
    \pagestyle{empty}
    \\begin{document}
    {\huge
    %s
    \end{document}"""% (str_latex_note)
        ## write latex file
        cur_path = r'/Users/mypath/Library/Scripts/OO_latex'
        cur_file = "temp.tex"
        fobj = open(os.path.join(cur_path, cur_file), 'w')
        fobj.writelines(preamble)
        fobj.close()
        ## process latex file
        print cur_path
        os.chdir(cur_path)
        cmd = 'latex temp.tex'
        print cmd
        print "running latex"
        os.system(cmd)
        cmd2 = 'dvips -E -f -X 1200 -Y 1200 temp.dvi > temp.ps'
        print "running dvips"
        os.system(cmd2)
        cmd3 = 'epstopdf temp.ps'
        print "running epstopdf"
        os.system(cmd3)
        print "done!"
    if __name__ == '__main__':
        main()

  • Running Shell Commands (not Executable) in Unix from Java

    What are my options to run shell commands from Java?
    My goal is to change my existing shell environment variables to some new ones provided by .anotherProfile.
    Using an executable from Java is not an option because it does not work i.e. ( exec(". /home/.profile") ) brings up errors.
    Someone has suggested that I start a child shell with that profile and work from there, but I'm unfamiliar with that sort of syntax and programming in general.
    Any good help equals duke dollars :)

    Well there are some possibilities. In the original thread you mentioned that you wanted the shell script to be executed to change some enviroment parameters of the shell the JVM is executing in.
    If so, and you are able to rewrite the profile so you can parse it manually. Then you can change some environment setting by writing the JNI wrappers for the getenv and setenv system calls. (Check your man pages)
    That will change the environment. I am just wondering what good it will do for you? What's use of sourcing the profile in a JVM?

  • 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

  • Running a Excel VBA Addin from Applescript

    Hi,
    I have created a VBA script in Excel 2011.  I want this scripot to be availbale to any workbook I open up in Excel so I have set the script as an Add-in.  Then I want to be abke to run this script from Applescript.  The final plan is to have an automater workflow which allows me to drag and drop an excel file onto it which will open the file, run the script I have told it to run and save the file again.
    I think it is a referencing issue I have, I'm using the "run VB macro" command but I am getting the referencing wrong somewhere along the line.  If anyone can help or point me in the direction of some good documentation it would be really helpful.
    Thanks

    the problem is that you keep trying to open the workbook when it is already open. in the attached code you will that I search to see if the workbook is open. If it is then I set it to be the active workbook and run the macro. If not then i open it and then run the macro.
    try the attached code and see if it works for you. You will hace to make sure that all the references are closed and that the comparison functionality works for you. I just kinda hacked this together as a proof of concept for you.
    Message Edited by Joe_H on 11-17-2009 12:04 PM
    Joe.
    "NOTHING IS EVER EASY"
    Attachments:
    excel_run_macro without open.vi ‏20 KB

  • Running odihragent from shell prompt

    Hi
    I am currently trying to run odihragent from a shell prompt to do some debugging however I am not sure of the date format that it expects? Can anybody help?
    /oracle/10gASR2/ldap/odi/bin/odihragent OracleHRAgent connect=find login=apps pass=*** date=200501011200
    status= -1
    Error - ORA-01722: invalid number
    Error in OCIStmtExecute
    Error in Execute
    HR Agent failed with Status:2

    well, the problem is not with the command line arguments. it doesnt matter if we get the input from the user through command prompt or GUI. The problem is only in the handling of the change in exitValue during running.

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

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

  • 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

  • How to run ps cs4 js script from applescript

    Hi, I need to call photoshop js from applescript. Here what I have so far:
    tell application "Adobe Photoshop CS4"
        activate
        set myScript to "Applications:Adobe Photoshop CS4:Presets:Scripts:_NDF_Ph_saveAsTif.jsx"
        do javascript (myScript)
    end tell
    and it's compiles, but when runs, gives me "Error 25: Expected: ;." message.
    How can I call ps script from as.
    Thank you very much for your help.
    Yulia

    You have 2 ways either JavaScript supplied as string or as file. If you are going the route of file then you need to coerce your path string to 'alias' this will fail if it does NOT exist. Here are 2 examples. You also have option to pass arguments as list.
    -- As String
    set JavaScript to "myTest();
    function myTest() {
    var docRef = app.activeDocument;
    var docWidth = docRef.width;
    var docHeight = docRef.height;
    var docSize = docWidth + ' x ' + docHeight
    return docSize
    tell application "Adobe Photoshop CS2"
    activate
    set Doc_Ref to the current document
    tell Doc_Ref
    do javascript JavaScript ¬
    show debugger on runtime error
    display dialog the result
    end tell
    end tell
    -- As File
    set ScriptPath to (path to applications folder as text) & "Adobe Photoshop CS2:Presets:Scripts:Hello.jsx" as alias
    tell application "Adobe Photoshop CS2"
    activate
    set Doc_Ref to the current document
    tell Doc_Ref
    do javascript ScriptPath ¬
    show debugger on runtime error
    end tell
    end tell

  • Running shell command from Java, but from Windows Schedule Task?

    I have a simple java program that will start a dos based program. The java program works great when I run it, but when I run it from the Windows Task Scheduler, the dox box that should pop up, does not. It is running because I can see it in the task manager but I can not see the command window.
    Any ideas how to show the command window from a java application that is ran from Windows Task Scheduler?
    Example program below. Runs fine by itself, should get a dos popup that issues the directory command, run it from the scheduler and it does not show the dos box. You can however see it in the Processes as CMD.exe.
    import java.io.IOException;
    public class Test {
          * @param args
         public static void main(String[] args) {
              try {
                   Runtime.getRuntime().exec("cmd /k start dir");
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    }Now the my real program is quite a bit more complicated. It actually goes out and checks the status of an Oracle Database, if all the tablespaces are online, then the middle tier application is allowed to start. The middle tier application is started by my java application, and is comes up with a dos console which shows status and users connected to the database.

    Jag,
    Actually, the question of whether it works for me seems to depend on the version of the OS (or Oracle). On RedHat Linux (Oracle 8.1.6) it didn't work at all, but on Solaris (Oracle 9.0.2) it did. Here's the output from that run:
    SQL> /
    output of the command run:
    init.ora
    initDBPart9i.DBPSun01.ora
    initdw.ora
    lkDBPART9I
    orapw
    orapwDBPart9i
    spfileDBPart9i.ora
    Done
    PL/SQL procedure successfully completed.
    But, I did need to change a line of your code to this:
    Process p = Runtime.getRuntime().exec("/usr/bin/ls");
    your original was:
    Process p = Runtime.getRuntime().exec("ls");
    You might consider, if possible, use of some of the Java File classes instead of ls, as this might make things more predictable for you. There were some examples in oramag.com a few months ago, but they were pretty simple (you might not need them).
    Hope this helps,
    -Dan
    http://www.compuware.com/products/devpartner/db/oracle_debug.htm
    Debug PL/SQL and Java in the Oracle Database

  • Running a command in Exchange Management Shell from Winexe

    The following works nicely when run from a dos prompt locally... 
    C:\Users\s-idauto>PowerShell.exe
    -command ". 'C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1';
    Connect-ExchangeServer -auto; New-MailboxExportRequest -Mailbox "my_testuser" -FilePath "\\deonetapp01\userarchive$\my_testuser.pst"
    but I want a version that I can run remotely from winexe, so I tried escaping quotes like 
    /usr/bin/winexe -U dallasray/administrator%somePassword //10.0.1.111
    "PowerShell.exe -command \". \'C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1\'; Connect-ExchangeServer
    -auto;"
    but that yields an error of "ERROR: Cannot open control pipe - NT_STATUS_INVALID_PARAMETER"

    Hi Rich,
    Agree with others, "enable remoting on the Exchange server" provided by Johan Dahlbom means that you need run  Enable-PSRemoting -force
    in the exchange server you want to access remotely, then you can start a new session with New-PSSession on another server.
    And for the 'ConnectionURl', you can specify the ConnectionUri in the form of
    http://$servername/powershell, for more detailed information, please also refer to these articles:
    Learn How to Use PowerShell to Run Exchange Commands Remotely:
    https://blogs.technet.com/b/heyscriptingguy/archive/2012/01/23/learn-how-to-use-powershell-to-run-exchange-server-commands-remotely.aspx
    Single Seat Administration of Exchange 2010 using PowerShell Implicit Remoting:
    http://blogs.technet.com/b/ptsblog/archive/2011/09/02/single-seat-administration-of-exchange-2010-using-powershell-implicit-remoting.aspx
    I hope this helps.
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Run shell commands using java program

    Hi guys,
    I am trying to run shell commands like cd /something and ./command with arguments as follows, but getting an exception that ./command not found.Instead of changing directory using "cd" command I am passing directory as an argument in rt,exec().
    String []cmd={"./command","arg1", "arg2", "arg3"};
    File file= new File("/path");
    try{
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec(cmd,null,file);
    proc.waitFor();
    System.out.println(proc.exitValue())
    BufferedReader buf = new BufferedReader(new InputStreamReader(proc.getInputStream()));
    catch(Exception e)
    {e.printStackTrace();
    So can anyone please tell me what is wrong with this approach? or is there any better way to do this?
    Thanks,
    Hardik

    warnerja wrote:
    What gives you the idea that the process to execute is called "./command"? If this is in Windows, it is "cmd.exe" for example.It does not have to be cmd.exe in Windows. Any executable or .bat file can be executed as long as one either specifies the full path or the executable is in a directory that is in the PATH.
    On *nix the file has to have the executable bit set and one either specifies the full path or the executable must be in a directory that is in the PATH . If the executable is a script then if there is a hash-bang (#!) at the start of the first line then the rest of the line is taken as the interpreter  to use. For example #!/bin/bash or #!/usr/bin/perl .
    One both window and *nix one can exec() an interpreter directly and then pass the commands into the process stdin. The advantage of doing this is that one can change the environment in one line and it  remains in effect for subsequent line. A simple example of this for bash on Linux is
    import java.io.OutputStreamWriter;
    import java.io.Writer;
    public class ExecInputThroughStdin
        public static void main(String args[]) throws Exception
            final Process process = Runtime.getRuntime().exec("bash");
            new Thread(new PipeInputStreamToOutputStreamRunnable(process.getErrorStream(), System.err)).start();
            new Thread(new PipeInputStreamToOutputStreamRunnable(process.getInputStream(), System.out)).start();
            final Writer stdin = new OutputStreamWriter(process.getOutputStream());
            stdin.write("xemacs&\n");
            stdin.write("cd ~/work\n");
            stdin.write("dir\n");
            stdin.write("ls\n");
            stdin.write("gobbldygook\n"); // Forces output to stderr
            stdin.write("echo $PATH\n");
            stdin.write("pwd\n");
            stdin.write("df -k\n");
            stdin.write("ifconfig\n");
            stdin.write("echo $CWD\n");
            stdin.write("dir\n");
            stdin.write("cd ~/work/jlib\n");
            stdin.write("dir\n");
            stdin.write("cat /etc/bash.bashrc\n");
            stdin.close();
            final int exitVal = process.waitFor();
            System.out.println("Exit value: " + exitVal);
    }One can use the same approach with Windows using cmd.exe but then one must be aware of the syntactic differences between commands running in .bat file and command run from the command line. Reading 'help cmd' s essential here.
    The class PipeInputStreamToOutputStreamRunnable in the above example just copies an InputStream to an OutputStream and I use
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    public class PipeInputStreamToOutputStreamRunnable implements Runnable
        public PipeInputStreamToOutputStreamRunnable(InputStream is, OutputStream os)
            is_ = is;
            os_ = os;
        public void run()
            try
                final byte[] buffer = new byte[1024];
                for (int count = 0; (count = is_.read(buffer)) >= 0;)
                    os_.write(buffer, 0, count);
            } catch (IOException e)
                e.printStackTrace();
        private final InputStream is_;
        private final OutputStream os_;
    }

  • Applescript won't run as .app but runs fine in AppleScript Editor

    I'm an experienced web developer.. but total applescript noob. so forgive me if this is a silly question.
    I'm calling my script it from Flash via fscommand to launch a PDF using finder, rather than a browser.
    The script works great from AppleScript Editor when i hit run but when saved as a .app it doesn't run.
    any ideas?
    Here's the code:
    property fileName : "my.pdf"
    set myPath to (path to me as string)
    set AppleScript's text item delimiters to ":"
    set the parentFolder to ¬
    ((text items 1 thru -2 of myPath) & "") as string
    set AppleScript's text item delimiters to ""
    try
    set targetFile to alias (the parentFolder & fileName)
    on error
    return quit
    end try
    tell application "Finder"
    open file targetFile
    end tell

    A script application is actually an application bundle - a bundle is a kind of folder that gets treated like a single item (in this case, an application). Getting path to me results in a path that ends with a colon (since it is a folder), so when you try to use text item delimiters to get the container you are actually just stripping off the trailing colon, so the path built for your file won't point to the correct location.
    As previously posted, the Finder can get the container, so you can just do everything in a tell application "Finder" statement:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #DAFFB6;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    property fileName : "my.pdf"
    set myPath to (path to me)
    tell application "Finder"
    set the parentFolder to container of myPath
    try
    open file ((parentFolder as text) & fileName)
    end try
    end tell
    </pre>

  • Dbms_scheduler error when running shell script

    I have 2 shell scripts.
    ftp_file_from_apps.sh copies a file from one server to antoher. It receives an input which is the name of the file to be copied.
    scp_file_to_dbs.sh does a secure copy. Copying the file fo anther directory on the same server.
    ftp_file_from_apps.sh
    ~~~~~~~~~~~~~~~~~
    #!/bin/bash
    sftp applprod@<host.domain>:/<source_directory>/$1
    /<destination_directory>/$2
    scp_file_to_dbs.sh
    ~~~~~~~~~~~~~
    scp -r /<source_directory>/$1 <host.domain>:/<destination_directory>/$1
    Both of these scripts works 100% when i run them from os level:
    ftp_file_from_apps.sh xxx.out xxx.pdf
    scp_file_to_dbs.sh xxx.pdf
    the problem is when i run them with dbms_scheduler:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    v_file_name and v_file_name_pdf is varchar2(20) with values assigned.
    begin
    dbms_scheduler.create_job(
    job_name=>'FTP_FILE_FROM_APPS',
    job_type=>'executable',
    job_action=>'/<directory_of_script>/ftp_file_from_apps.sh
    v_file_name v_file_name_pdf',
    enabled=>TRUE
    end;
    begin
    dbms_scheduler.create_job(
    job_name=>'SCP_FILE_TO_DBS',
    job_type=>'executable',
    job_action=>'/<directory_of_script>/scp_file_to_dbs.sh
    v_file_name_pdf',
    enabled=>TRUE
    end;
    ftp_file_from_apps.sh error:
    ORA-27369: job of type EXECUTABLE failed with exit code: No such file or directory
    scp_file_to_dbs.sh error:
    ORA-27369: job of type EXECUTABLE failed with exit code: No such file or directory
    I tripple checked my <directory_of_script>.
    Please help.
    Regards
    John

    Hi,
    What Paul means is that you should not be using
    job_action=>
    '/<directory_of_script>/scp_file_to_dbs.sh v_file_name_pdf',
    Instead job_action should be the name of the shell script only. So you should have
    job_action=>
    '/<directory_of_script>/scp_file_to_dbs.sh',
    number_of_arguments=>1
    enabled=>false
    And then make a call to dbms_scheduler.set_job_argument_value (for each argument) and finally a call to dbms_scheduler.enable.
    Hope this helps,
    Ravi.

Maybe you are looking for

  • Error when using PPR in the OA page developed.

    HI, We are encountering an error when using PPR for the custom OA page being developed. I am using JDeveloper version 9.0.3.5(Build 1437) and Oracle Applications version 11.5.10.CU2. The scenario we are using PPR and the steps to reproduce the issue

  • View widgets in full screen

    Is it possible to view widgets in full screen.  I have only been able to get the half screen presentation.  That is very cluttered and small for my older eyes.  Of course, I can click on pictures within updates and see those full screen, but I am tal

  • How do you change the height of a cell in the Bookmark tab?

    How do you change the height of a cell in the Bookmark tab?

  • The Photo Library needs to be upgraded....

    "The Photo Library needs to be upgraded to work with this version of iPhoto." This came up as I opened iPhoto 4.0.3. which I have been running since June 05. I don't think and I looked to see if iPhoto got updated, all looks the same. Please advise a

  • Webcam recording application

    Hi all. I am pretty new to Flash development so here goes. I have got FMS dev server running and it seems to work. Also have the trial version of CS5 and using FlashDevelop. There is an absolute barrage of information on the topic at hand but never a