DBMS_SCHEDULER and Shell Script on 10.2.0.1

Hi All
My env, Oracle 10.2.0.1 and OS is Solaris.
My script can run on OS that is work without error that contain create file, delete file, call sqlplus, function to get value from database and return to OS variables.
In shell script some code as below
get_val () {
sqlplus -s /nolog <<EOF
conn test/test
set heading off
set feedback off
set pages 0
SELECT SUBSTR (SYS_CONNECT_BY_PATH (Z, ' '), 2) z
      FROM (SELECT NAMEDQUERY , ROW_NUMBER () OVER (ORDER BY Z) rn,
                   COUNT (*) OVER () cnt
              FROM X
              WHERE Z LIKE '%FULL')
     WHERE rn = cnt
START WITH rn = 1
CONNECT BY rn = PRIOR rn + 1;
EOF
vx=$(get_val)
if [ ${#vx} -gt 0 ]; then
for xfile in $vx
do
rm -f $CURRDIR/$xfile.txt 2> /dev/null
done
fi
When run by dbms_scheduler that show below error
ORA-27369: job of type EXECUTABLE failed with exit code: No such file or directory
STANDARD_ERROR="/home/oracle/script/test.sh: syntax error at line 26: `vx=$' unexpected
How to resolve above error?  (owner of $CURRDIR/$xfile.txt is oracle user)
One more question, How to force dbms_scheduler that using user oracle (OS) to run shell script?, as I know, default user is nobody and Oracle version 10.2.0.2 later that have external.job.ora to set it but 10.2.0.1 doesn't have it.
Thank you in advance,
Hiko

I changed scheduler by set argument as below
dbms_scheduler.create_job (job_name=>'TEST',job_type=>'EXECUTABLE',job_action=>'/usr/bin/bash',number_of_arguments=>1);
dbms_scheduler.set_job_argument_value('TEST',1,argument_value,'/home/oracle/test.sh');
That is work. below is conclusion to did
1. Change permission of $ORACLE_HOME/bin/extjob to 4750 (-rwsr-x---)
2. Change owner of $ORACLE_HOME/bin/extjob to oracle:dba
3. Use '/usr/bin/bash' instead of '/usr/bin/sh'
But I found error about download file process that I'm using wget to download source file in shell script and run by dbms_scheduler as above.
My problem, first file can download normally and process until finish but second file was hang.
Do you have any idea or solution to prove and resolve it?
Thank you,
Hiko

Similar Messages

  • Error with dbms_scheduler and shell script execution

    Hi,guys.
    I have an issue with a dbms_scheduler and a shell script execution. So, the shell script as it self works fine, when i'm executing ./test.sh all process is running, but when i'm executing the script from dbms_scheduler it just simply doesn't work. Actually it works, but some of executable information in sh doesn't work, seems it just jump over of the part of the script. Sendmail part is running, maybe there is problem with rman script as it self?
    DB version: 10g
    And my scripts:
    Shell scripts (permisons 755):
    #!/bin/ksh
    export PATH=/home/oracle/product/asm_home/bin:/home/oracle/product/db_home/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/oracle/bin:/usr/bin/X11:/sbin:.
    export ORACLE_BASE=/home/oracle/product
    export ORACLE_SID=zabbix
    export ORACLE_HOME=/home/oracle/product/db_home
    ${ORACLE_HOME}/bin/rman<<EOF
    connect target /
    run {backup recovery area delete all input;}
    EOF
    {       echo "From:[email protected]"
            echo "To: [email protected]"
            echo "Subject: Recovery area"
            echo 'Content-Type: text/html'
            echo
            echo '<html><body><table border="1" cellspacing="1">'
            echo '<tr><td><b>Process</b></td><td><b>Statuss</b></td></tr>'
            echo "<tr><td>RMAN</td><td><b>Works</b></td></tr>"
            echo "</table></body></html>"
    } | sendmail -tIn the first part i'm exporting all of the important stuff for oracle, then I call RMAN with specific atributes. And then there is just simply sendmail functionality inside script to represent if script works (for now).
    And below pl/sql script:
    begin
      DBMS_SCHEDULER.CREATE_JOB
      job_name => 'FLASH_RECOVERY',
      job_type => 'EXECUTABLE',
      job_action => '/home/oracle/backup/test.sh',
      start_date => sysdate,
      job_class => 'DEFAULT_JOB_CLASS',
      enabled => TRUE,
      auto_drop => FALSE,
      comments => 'FLASH RECOVERY USAGE AREA backup and delete'
      END;
      /And this job execution:
           begin
               DBMS_SCHEDULER.run_job (job_name =>'FLASH_RECOVERY',use_current_session => TRUE);
           end;What can be wrong? For me, I think it's something with permisions.
    I hope you got my idea and could help me.
    Tom
    Edited by: safazaurs on 2013.18.2 22:16

    There is no error, i just receive all the time e-mail, seems it jumps over rman. I tried almost everything and still couldn't get result as i want. And, if i'm running script from command line - it works. Rman calls, and starts to recover archivelogs.

  • Rman windows and  Shell Script

    hi,
    How to take the backup by windows script and shell script.please any one tell that.
    thanks
    with regards

    Dear user!
    How to take the backup by script is a very imprecisely kind of question. So the only thing I can give you is a very imprecise answer.
    For linux shellscript you may use:
    vim my_backup_script.sh
    #!/bin/bash
    BACKUP DATABASE;Save and run this script in the following way:
    rman target / catalog catuser/password@CATDB CMDFILE my_backup_script.shYou may customize this script to fit your needs. On Windows you may write a batchscript like that:
    notepad my_backup_script.bat
    BACKUP DATABASE;Save and run this script like that:
    rman target / catalog catuser/password@CATDB CMDFILE my_backup_script.batMaybe if you could state your needs a little bit more precisely I could give you a more helpful answer.
    Yours sincerely
    Florian W.

  • Xgettext for perl and shell scripts on Solaris 9

    Hi......I have to internationalized perl and shell scripts on Linux and Solaris 9.
    I have used gettext on linux to internationalized both perl and shell scripts but on solaris i m not able to
    achieve the same.
    If we see help of xgettect on Linux, it shows input file options for Perl, Shell, C, C++ etc but help for
    xgettext on Solaris shows input file option for C only.
    Can you please provide me some way of using xgettext for perl and shell scripts on Solaris 9 or
    is there any other way of internationalizing perl and shell scripts on Solaris 9.
    Many Thanks,
    Lokesh

    Signature link blocked.
    db
    Contentprise wrote:
    Hi......I have to internationalized perl and shell scripts on Linux and Solaris 9.
    I have used gettext on linux to internationalized both perl and shell scripts but on solaris i m not able to
    achieve the same.
    If we see help of xgettect on Linux, it shows input file options for Perl, Shell, C, C++ etc but help for
    xgettext on Solaris shows input file option for C only.
    Can you please provide me some way of using xgettext for perl and shell scripts on Solaris 9 or
    is there any other way of internationalizing perl and shell scripts on Solaris 9.
    Many Thanks

  • Dbms_Scheduler and executable script

    Hi,
    I have a scenario. I was running a shell script (which in turn runs an oracle procedure) every 30 minutes and put it in cron. Now, this was before when the procedure used to take less than 30 minutes.
    Now a days, intermittently, it takes MORE than 30 minutes. So, the second run of the procedure is not obeying the limits set for the program.
    What I would like to have is have ONE instance of the shell script(it emails after the procedure is run), running at any given time. So, if the cron fires up and it sees that there is already one instance of the script running and this shouldn't run now.
    The way I was trying to do this is like this:
    i). Use dbms_scheduler to run the executable and somehow (I need help here on how) stopping the next run to not fire IF there is one already running.
    or
    ii). Use dbms_scheduler to run the actual procedure and somehow allowing only ONE run of the procedure at any given time (In this scenario, I have to take care of the email from Oracle itself instead of from unix).
    or
    iii). There is another solution where I was using autonomous transaction to update a table that the program is running and then NOT run the same procedure when it is already running. But, since this is an in-house solution and Oracle might have something for this already, I would like to use the Oracle one.
    Thank you.

    Hi,
    Actually i) is done for you automatically. If you schedule a job to run periodically and the last run runs over the next start date then dbms_scheduler will automatically skip the next run and go to the next one. dbms_scheduler never has two instances of the same job running at the same time.
    So you don't need any extra concurrency control. If you do need concurrency control, dbms_lock offers a simple way to protect access to a resource (e.g. if only one session should be accessing a table at a time).
    Finally if you just need e-mail sent when a job fails you can use an Oracle-provided utility on the Scheduler home page
    http://www.oracle.com/technology/products/database/scheduler/index.html
    Look for the job notification package under Scheduler Utilities which will make it very easy to send e-mail when your job fails.
    If you have any further questions, feel free to ask !
    -Ravi

  • SQL LOADER and SHELL SCRIPT ISSUE

    Hello Guys,
    I know this not the right forum but i am not sure where i should post this.
    Pelase help
    I am running a shell script which is giving me error
    Username:SQL*Loader-128: unable to begin a session
    ORA-01017: invalid username/password; logon denied
    SQL*Loader: Release 10.2.0.4.0 - Production on Thu Nov 19 13:02:04 2009
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    SQL*Plus: Release 10.2.0.4.0 - Production on Thu Nov 19 13:02:06 2009
    Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
    Enter user-name:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL>
    0 rows updated.
    Commit complete.
    SQL> SQL> Disconnected from Oracle Database 10g Enterprise Edition
    SQL> SQL> Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options Thu Nov 19 13:02:06 EST 2009In shell script i have used the same username and passwd which i am using from command line
    the shell script is calling sql loader to load file
    and for that also the username and passwd is same.
    i am able to run sqlldr command from command line dont knw why here its giving error
    here is my shell script
    set -a
    . $HOME/.edw.env
    . $admlib/checklib.sh
    LOGDIR=$admsrc/sigma6/ppadala/copg
    LOGFILE=${LOGDIR}/log/test`date '+%m%d'`.xtr
    DB_USER=copg
    DB_PWD=copg
    set +a
    cd $LOGDIR
    if test ! -f $admsrc/sigma6/ppadala/copg/DM_Daily_EFolderCloseCancel_Report_11192009.txt
    then
       echo "Error: DM_Daily_EFolderCloseCancel_Report_11192009.txt does not exist and/or is not a regular file." >> ${LOGFILE}
       exit 1
    fi
    echo 'End of Checking for the existence of the file - Successful'>> ${LOGFILE}
    sqlldr control=$admsrc/sigma6/ppadala/copg/Close_Cancle.ctl log=$admsrc/sigma6/ppadala/copg/Close_cancle.log
    userid=${DB_USER}/${DB_PWD} silent=\(HEADER,FEEDBACK,DISCARDS\)>> ${LOGFILE} 2>&1
    case $? in 0) :;;1|3) echo "Error: SQL Loader" >> ${LOGFILE}
         exit 1;;
    esac
    sqlplus << EOD
    ${DB_USER}/${DB_PWD}
    @Close_Cancle.sql
    EOD
    if [ $? -ne 0 ]
    then
        echo "Error: SQL Plus for script Processing" >> ${LOGFILE}
        echo "Resi Unit Scheduling Report Refresh failed" >> ${LOGFILE}
    fi
    ) > ${LOGFILE} 2>&1
    echo `date` >> ${LOGFILE}
    if [ -f ${LOGFILE} ]
    then
    mail -s "Resi Unit Scheduling" "[email protected]" < ${LOGFILE}
    sleep 3
    `ck_error ${LOGFILE}`
    fiplease help guys
    thanks

    Thanks for the reply
    In Close_cancle.log also its the same msg which i posted.
    logon denied..............
    and this is the log file contents when i do set - X on
    + cd /u2144009/src/sigma6/ppadala/copg
    + test ! -f
    + /u2144009/src/sigma6/ppadala/copg/DM_Daily_EFolderCloseCancel_Report_1
    + 1192009.txt echo End of Checking for the existence of the file -
    + Successful
    + 1>> /u2144009/src/sigma6/ppadala/copg/log/test1119.xtr
    + sqlldr control=/u2144009/src/sigma6/ppadala/copg/Close_Cancle.ctl
    + log=/u2144009/src/sigma6/ppadala/copg/Close_cancle.log
    Username:SQL*Loader-128: unable to begin a session
    ORA-01017: invalid username/password; logon denied
    SQL*Loader: Release 10.2.0.4.0 - Production on Thu Nov 19 17:32:17 2009
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    + userid=copg/copg silent=(HEADER,FEEDBACK,DISCARDS)
    + 1>> /u2144009/src/sigma6/ppadala/copg/log/test1119.xtr 2>& 1
    + :
    + sqlplus
    + 0<<
    copg/copg
    @Close_Cancle.sql
    SQL*Plus: Release 10.2.0.4.0 - Production on Thu Nov 19 17:32:58 2009
    Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
    Enter user-name:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL>
    0 rows updated.
    Commit complete.
    SQL> SQL> Disconnected from Oracle Database 10g Enterprise Edition
    SQL> SQL> Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    + [ 0 -ne 0 ]
    Thu Nov 19 17:32:59 EST 2009Edited by: user10647455 on Nov 19, 2009 2:35 PM

  • Command line parameters and Shell Script -- URGENT

    Hi folks,
    I am facing some problem in the Shell script and the command line parameter.
    The scenario is -- I am picking a file from a directory, whose path is <b>/interfaces/xid/receive/filename.dat</b>
    I have to encrypt filename.dat and move it to another folder, whose path is <b>/interfaces/xid/send</b>. So, the encrypted file will reside in the <b>send</b> directory.
    Now, I don't want to hardcode the new path, where the encrypted file has to be moved. Please let me know how to achieve this. Please consider this as urgent.
    Have a look at the command line in the "before message processing"  -- <b>/interfaces/xid/receive/xi_decompress.sh  /interfaces%F</b>
    Have a look at the shell script for the same --
    #!/bin/sh
    Setup environment variables
    COMMPRESS_DIR=/interfaces/software/commpress
    export COMMPRESS_DIR
    LOG_DIR=/interfaces/software/commpress/log/
    export LOG_DIR
    IN_FILE=$1
    export IN_FILE
    Find the directory where the unencrypted file is deposited
    IN_FILE_DIR=`dirname $1`
    export IN_FILE_DIR
    Make sure the working directory is where the unencrypt.key is...
    cd $COMMPRESS_DIR
    encrypt the file
    if [ `uname` = "HP-UX" ]
    then
       find $IN_FILE | $COMMPRESS_DIR/compx $IN_FILE_DIR logpath=$LOG_DIR
    else
       find $IN_FILE | $COMMPRESS_DIR/compx-sun $IN_FILE_DIR logpath=$LOG_DIR
    fi
    Get the result of the encryption
    RET_CODE=$?
    Check decryption result
    If error (retuen code <> 0), create an error log file in the
    same directory as the input file.
    if [ $RET_CODE -ne 0 ]
    then
        PREFIX="Decryption"
        DATE_TIME=$(date +%Y%m%d_%H%M%S%N)
        SUFFIX="err"
        FILENAME=$/$_$.$
        echo "Decryption Error log"        >$FILENAME
        echo "DATE_TIME:  $"   >>$FILENAME
        echo "DIRECTORY:  $" >>$FILENAME
        echo "FILE:       $"     >>$FILENAME
        echo "ERROR CODE: $"    >>$FILENAME
    fi
    exit $RET_CODE
    What else I need to add in this piece of code? Urgent help !!
    Thanks a lot in advance.
    Neetesh

    Hi Satish,
    I was able to figure that out, that we need to hard code the path as the 2nd parameter.
    But I guess there is a way out in Unix where we can handle this situation, where we are not willing to hard code.
    Anyways, thanks a lot for your input .. -:)
    Cheers,
    Neetesh

  • BPEL processes and shell scripts

    Hi,
    I wish to invoke BPEL processes from a shell script so that it could be regulated from a typical Control-M environment. Can anybody let me know if its possible...?
    Regards,
    Roy

    Some kind-of Java interface would just be fantastic. Is there anything like that...?
    Well, I intend to execute some batch processes which would be scheduled and administered by Control-M; If i opt to use ws-clients within the same then auditing and monitering the status of my executing process would be an obvious overhead that i might need to hard wire in my implementation. Therefore, should it be possible to execute a BPEL process from a Java like interface, which i'd then wrap in a shell script; then Control-M on itself would be capable of monitoring the process status and all other performance parameters around the same.
    Suresh - Thanks for your suggestion, will definately post the message on those groups as well.

  • File locking and shell script

    Hi,
    with Mac OS X is there a file locking system to prevent file to be copyied or move to a folder B before they are completely copyied in folder A ?
    Regards

    The files in folder A are created by a program like
    Pitstop
    My question was : what can happen if a file in folder
    A is not complitely created and the shell script
    attempt to copy it ?
    In general, if the shell script attempts to copy a file before the creator is finished writing to it, the shell script will copy the part of the file that's already present, so the copy will be incomplete. The creating application can prevent that (by writing to a temporary file and changing the name of the file only after it's finished writing, or by making the file readable only after it's done), but that's up to the application.

  • Mount script for ext2 - mixing applescript and shell script

    Hello
    i want to do a .app using the ScriptEditor to get my external usb-disc mounted.
    I tried ExtFS Manager before, but was not as happy with it.
    so the basic idea is some kind of mixture of apple script and bash-shell script, but im not sure how to combine it.
    shell script:
    #!/bin/sh
    sudo kextload /Library/Extensions/ext2fs.kext
    mkdir ~/usb_music/
    sudo mount -t ext2 -o nosuid,w,m=777,user /dev/disk1s5 ~/usb_music/
    sudo chmod a+rwx ~/usb_music/
    apple-script:
    on run
    try
    do shell script ""
    end try
    end run
    any ideas how to get it combined and working ?
    best regards
    fidel
    MacBookPro 15,4" 1,83 GHz   Mac OS X (10.4.8)  

    is there a way to implement it in a way that normal users can work with sudo to mount the drive ?
    kextload requires superuser privileges, so at some point some part of your script is going to need to run with elevated privileges.
    It is possible to configure sudo to allow non-admins to run any other commands. You could either allow non-admins to to run kextload or, preferably, allow them to run your shell script.
    man sudoers will give you the details on how to configure sudo to do this, which might be as simple as:
    <pre class=command>ALL  ALL=(ALL) /usr/local/bin/myscript</pre>
    This will allow all users to run /usr/local/bin/myscript as root.

  • Java and Shell Scripts

    I have created a java program that its main target is to read from a log file. The GUI has six buttons and its button has a script running each time the button is being hit. The results of the script are presented on a JTextArea automatically. So I have six buttons and six scripts. The problem is that the first time the program works fine. But if I click one button for the second time I get no results or wrong results. The scripts alone(when they work without the java program) work right.
    Is this a memory problem? How can I have the scripts with the java program work right together? I must say that each script needs 4-5 seconds to execute and immediately after the execution, the results, as I told before, are shown in a JTextArea. How can I solve the problem, so that I have the right results every time I click the buttons and not just for the first time?
    I need your ideas as soon as possible. :)))
    For connecting the java program and the shell scripts I use:
    Process proc = Runtime.getRuntime().exec("bash script ");
    OutputStream out = proc.getOutputStream();
    PrintWriter p = new PrintWriter(out);
    p.flush();     

    I think u must use process.waitFor() method .
    By this, u r sure that the said process shall complete.
    Also I would recommend new Instance/Thread for running each script.

  • Java and shell scripts - get password

    HI all,
    Im writing an installation prg using java appl on linux by running shell scripts. For this, I want to get root passwd in a text field from the user and use it in shell script (for cmd su) to get root login and to install my pkg.
    Can u help me to do this ???
    thanks in advance,
    rameshvl

    My only requirement is to install java (I have
    I have jdk rpm with me !!)
    with a user account. Hi ramesh,
    The discussion is now going a bit out of topic (this is a java forum).
    Unix Systems are multiuser systems. The users are organized to use the system concurrently. Therefore each user is able to write only in his area and in /tmp. If a user wants to install anything on this system he is able to do it in his area and not as root. root (the system administrator) is responsible for installing everything that is used by everybody. This means why do you have to start an application as user and then do something as root? Why don't you start the application as root and then be root to do everything you want?
    If you want the user to install java, why does he has to do this for everybody else on the system? Why not only install it in his home area? why the rpm, why not tar.gz?
    I hope this is a common reqmt of everybody, butNo this is not.
    I hope this helps
    M.

  • Sample shell script - to run procedures and shell script

    Hi ,
    I would like run some procedures in one shell script which passing parameters as username/password@dbname.
    1. Execute proce1
    2.Execute proce3
    3.Execute proc4
    Can you please give some script/idea how we will create shell script . I am using SunSolaris Unix operating system.I would appreciate your help.
    Regards,
    Clark

    user10818198 wrote:
    I would like run some procedures in one shell script which passing parameters as username/password@dbname.
    1. Execute proce1
    2.Execute proce3
    3.Execute proc4
    At a very basic level, based on the information you have provided, your shell script would be something like this:
    sqlplus /nolog <<EOF
    connect username/password@dbname
    exec proce1;
    exec proce2;
    exec proce3;
    exit
    EOFBesides this, you could:
    (1) Add the shebang at the top, to specify the shell you are using, e.g. #!/bin/ksh for the Korn shell etc.
    (2) Ensure that "sqlplus" is recognized by the shell, by maybe running an "ora_env.sh" script that sets Oracle parameters. More likely, if you are using this Unix account for interaction with Oracle, then you may want to add the Oracle parameter information in your .profile or .bash_profile or .csh_profile etc. in the home directory.
    (3) Run a few sqlplus commands right before calling those stored procedures, if needed. For example, if you want to exit from sqlplus (and Oracle) if an error occurs while executing any procedure, then add this -
    whenever sqlerror exit 1Thus your script becomes:
    #!/bin/ksh
    # Ensure that Oracle parameters are set by this point
    sqlplus /nolog <<EOF
    connect username/password@dbname
    whenever sqlerror exit 1
    exec proce1;
    exec proce2;
    exec proce3;
    exit
    EOF(There are other settings as well; it really depends on your requirements.)
    Can you please give some script/idea how we will create shell script . I am using SunSolaris Unix operating system.
    How to create a shell script ? Well,
    (1) Save the commands shown above in a file, using your favorite text editor. Name the file "my_script.sh" or "<a_better_name>.sh" etc. (or maybe ".ksh" for the Korn shell - it's just a best practice, the shell doesn't really care.)
    (2) Make your script executable, like so -
    $ chmod 744 myscript.sh(3) And then execute it -
    $ ./myscript.sh- You could also execute the script in the current shell (as against a child shell) by doing this after Step (1):
    $ . myscript.shHope that helps.
    If there are specific questions, then post them here.
    isotope

  • Applescript with Mail attachments and shell scripts (pdftk)

    I'm trying to create a script that I can call using mail rules that will:
    1. save an attached PDF file to a folder (folder name is 'PDFs_from_Mail:')
    2. save each page of the PDF as a separate file
    3. delete the old file
    so far, i used the script below called from mail to save the attachments to the
    -- script called from mail
    using terms from application"Mail"
      onperform mail action with messages theMessages
        tell application"Finder" to set ptd to (path to desktopfolder) as string
        tell application"Finder" to set pathToAttachments to(path to desktop folder as string) &"PDFs_from_Mail:"
        tell application"Mail"
           repeatwith theMessage in theMessages
                if theMessage's mailattachments is not {} then
                      repeatwith theAttachment in theMessage's mailattachments
                            settheFileName to pathToAttachments & theAttachment's name
                            try
                                     save theAttachment in theFileName
                              onerror errnum
                            endtry
                      endrepeat
                end if
             endrepeat
          end tell
      endperform mail action with messages
    end usingterms from
    tell application"Mail"
        setmyMessages to selection
        tellme to perform mail action with messages myMessages
    end tell
    -- end of script called from mail
    after the file is in the folder, i'd like to automatically call a script that splits it in to pages and saves each file.  I found pdftk can do what I need.  I got the following working, which uses a folder action script to process the file:
    -- burst script
    on addingfolder items to this_folder after receiving added_items
       tellapplication "Finder"
           set fold_name tothe name of this_folder
               try
                   repeatwith i from 1 to number ofitems in added_items
                          set theFile toitem i of added_items
                          set oldDelimiters toAppleScript's text item delimiters
                          set AppleScript's textitem delimiters to {":"}
                          set theFolder to(((text items 1 thru ((count everytext item of (theFile asstring)) -1)) of (theFile asstring))) as string
                          set AppleScript's textitem delimiters to oldDelimiters
                                --get the file name
                                   set theFileName to the name of theFile
                                                     do shell script"/usr/local/bin/pdftk " & (POSIX path oftheFile) & " burst output " & (POSIXpath of theFolder) & "/" & theFileName &"_%03d.pdf"
                                                      delete theFile
                                                    endrepeat
                                        end try
                         endtell
    end adding folder items to
    -- end burst script
    the shell script that is called is in the format:
    pdftk myfile.pdf burst
    the output parameter basically adds the page number to the end of the original filename for each file that is created
    my idea was to attach the folder action script to the 'PDFs_from_Mail' folder, and when the first script is called, the file would be saved to that folder and trigger the folder action script burst the file.  it works for individual messages, but when I try using it with the hundreds of messages that I have, all kinds of crazy things happen... the filenames are all wrong and it seems like it goes on infinitely.
    My familiarity with applescript is somewhat limited (as you may have guessed) and I'm wondering if there is a better approach.  perhaps if I incorporate the shell script into the script called from mail it may streamline everything.
    my problem is that I am not sure what code I need to keep in each script.
    can anyone take a quick look at this and give me some advice?
    my goal is to have these individual pages in a folder so that I can use quick view to page through them.  if the pdf is more than one page, then I have to get involved in scrolling up/down and it becomes difficult to find things efficiently.
    thanks!

    just a quick update and a general questions about applescripting with shell scripts...
    i attached the above folder action burst script to a folder, and have been dragging pdf files into it, one at a time.
    sometimes the script runs fine and the new files are created and the old pdf is deleted.  other times, there is a long delay between when I drop a pdf file into the folder and when the new files are created.  and sometimes nothing even happens at all (uaually if i dont wait for at least 30 seconds or so between dropping the files in the folder).  I also noticed that the window title text (area showing the folder name at the top of the finder window) becomes grayed out when the script is running and sometimes it remains grayed out for a few minutes after the script has run.
    could it be that the shell script just takes a really long time to work?  i am afraid to drop more than one file at a time as the last time I tried that the output was all wrong and I had to force quit processes and shut down. 

  • Procedure call and shell script

    When i try to pass a shell variable to a procedure call in a shell script it does not work. But a SQL command ( insert ) has no problem taking the shell variable. Has this something to do with context switch. How to get around this prbokem.
    `sqlplus <username/password> -silent << EOF
    set serveroutput on size 1000000
    exec procA; -- works
    exec procB($shell_variable); -- does not work
    insert into table1 values ($shell_variable); -- works
    EOF`
    Thanks!

    It works to me :
    TEST@db102 SQL> create or replace procedure isnumeric (num in varchar2)
      2  is
      3          a       number;
      4  begin
      5          a := to_number(num);
      6          dbms_output.put_line (num||' is a number');
      7  exception
      8          when others then
      9                  dbms_output.put_line (num||' is NOT a number');
    10* end;
    11  /
    Procedure created.
    TEST@db102 SQL> exec isnumeric(123);
    123 is a number
    PL/SQL procedure successfully completed.
    TEST@db102 SQL> exec isnumeric('abc');
    abc is NOT a number
    PL/SQL procedure successfully completed.
    TEST@db102 SQL>
    [ora102 work db102]$ cat callvar.sh
    export VAR=$1
    sqlplus -s test/test << EOF
    set serveroutput on size 1000000
    exec isnumeric('$VAR');
    EOF
    [ora102 work db102]$ ./callvar.sh 123
    123 is a number
    PL/SQL procedure successfully completed.
    [ora102 work db102]$ ./callvar.sh abc
    abc is NOT a number
    PL/SQL procedure successfully completed.
    [ora102 work db102]$                       

Maybe you are looking for

  • Need sample authority-check for division...

    Hello Experts, I want my report to check what division/s are valid to be processed by a certain user. For example, If I run the said report and I am only valid to process divisions 02, 15 and 16 then when I press F4 in the selection-screen(for the di

  • Php sql image editor - help with submit buttons!

    Hi, I have recently setup a website for my real-estate company, with a makeshift CMS behind it for my staff to use when updating properties. I have a slideshow on my site for each property, which is populated through sql blobs (I know alot of people

  • Data Object

    Hello All iam new to BAM and BPEL. our requirement is to see the monitor BPEL process acitvity using BAM. Java team had developed an BPEL application and in which they also developed sensors and deployed. When i am connecting thru BAM iam able to see

  • Using dimension and cube operator

    hi I am facing problem in using this dimension and cube operator.. Actually I want to create a sales data with dimensions as time,customer and product After creating a dimension in owb I get a table created attached with it same is the case with cube

  • MBP hangs when booting with network plugged in

    My macbook pro (just got it last week) seems to be hanging whenever the wired network is plugged in. as soon as i pull the network jack out, the MBP finishes booting into OSX. any ideas? is the network controller busted maybe?