How can i run unix script from my apex page

how can i run unix script from my apex page and take the output of unix script as a hidden variable and display it on the report region of that page

I had a requirement to run a Fortran program against some data that woudl be extracted from the database after the user set up their filtering criteria and made some additional input. SInce the program was to complex to conver to PL/SQL, we decided to try and invoke it from Apex. This is how I did it.
1. I followed the steps in Tim Archer's excellent article "Oracle External Procedure to Run Host Commands" (http://www.timarcher.com/?q=node/9). If the link does nto work, google the article's title.
Using this steps I created a function which accepts any OS command, including calling my own shell scripts, and runs them. I called my PL/SQL function "shell" instead of "USF_RUN_HOST_CMD " as Tim did in his example (step 9).
2. In Apex,
a. I created a button to run my shell command. (I named it P2_RUN_SHELL)
b. I created a PL/SQL process whose source looks as follows:
shell('/home/ackness/scripts/cr_xcf_file.sh > /tmp/cr_scfp_file.log');
and which was conditioned on the the button P2_RUN_SHELL.
It works like a charm.
Note: since you can run your own scripts using this method, you can encapsulate a series of commands in a UNIX shell script and invoke that script from Apex. This allows you to be able to test or run you commands from the command line as well as Apex and makes it easier to develop/debug/enhance the scripts in the future.
Ackness

Similar Messages

  • How can I run a script from path?

    Hi all
    How can a illustrator script be run from a path by double clicking the script file not from illustrator menu->scripts.
    thanks in advance
    THAMIL

    You can modify the script to use COM.  For example, when the script is run in AI, there is an assumed application object - you can just use the members of the Application object without having an explicit Application variable.  To do this in a standalone javascript, create a Illustrator.Application object:
    var app = new ActiveXObject("Illustrator.Application");
    var activeDoc = app.activeDocument;
    You would do something similar for any object that would otherwise need to be created with new.  You can get a list in the the registry - HKCR\Illustrator.*
    Note that .length and collection[i] don't work when you do this.  Use .count instead of .length.  You need to use Enumerators:
    var textEnum = new Enumerator(doc.textFrames);
    for (; !textEnum.atEnd(); textEnum.moveNext()) {
        var txt = textEnum.item();
        txt.contents = "text";
    You also have to use WScript.Echo() instead of alert().
    Phil

  • Hi I am new on the Mac, I need help, how can I run my apps from my library on my Mac Pro?  All my apps I was used in my iPad, thanks guys!!!!

    Hi I am new on the Mac, I need help, how can I run my apps from my library on my Mac Pro?  All my apps I was used in my iPad, thanks guys!!!!

    The Mac OS X and iOS versions are separate products

  • How can i call a zreport from my bsp page.

    Hi friends,
    How can i call a zreport from my bsp page.
    Moosa

    Hi Friend,
    These are the codings  to be wirtten in BSP for transferring values to the REPORT
    DATA:wf_date TYPE ztable-ID.
          data:seltab type standard table of rsparams,
           wa_seltab like line of seltab,
         event TYPE REF TO if_htmlb_data.
    DATA:p_value TYPE REF TO CL_HTMLB_INPUTFIELD.
    event = cl_htmlb_manager=>get_event( runtime->server->request ).
    p_requ ?= CL_HTMLB_MANAGER=>GET_DATA(
                                            request  = runtime->server->request
                                            name     = 'inputField'
                                            id       = 'i1'
    if p_requ is not initial.
      wf_date = p_requ->value.
    endif.
    clear wa_seltab.
    if wf_date is not initial.
      wa_seltab-selname = 'P_REQU'.
      wa_seltab-kind = 'P'.
      wa_seltab-option = 'EQ'.
      wa_seltab-low = wf_date.
      append wa_seltab to seltab.
    endif.
    submit *ZSAMPLEAP1* with selection-table seltab AND RETURN  .(ZSAMPLEAP1 refers to the report name and AND RETURN for coming back to the BSP page after the completion of its operation in Report )
    IMPORT int_name TO int_name FROM MEMORY ID '*zid*'.(For importing the obtained value from Report)
    In Report
    REPORT  ZSAMPLEAP1.
    SELECT-OPTIONS: p_requ FOR ztable-id  NO INTERVALS.
    SELECT SINGLE name from ztable into int_name WHERE id = p_requ-low.
    WRITE:int_name.
        EXPORT int_name TO MEMORY  ID 'zsharmila'.
    With Regards,
    SHARMILA BRINDHA.M

  • How can I run another application from my Form

    Dear Gurus,
    Can anybody tell how can I run a non oracle application from my Forms..
    Can it be done thru DDE package..
    If yes then how..??
    Can it be done like Excel calling thru DDE package???
    Thanks in Advance..
    Regards
    Swati..

    Keep in mind that HOST will execute where the runtime is located. This means for Forms 6.x and older, if the application is running as client/server, HOST will correctly execute on the client. If your application (Forms 6.x and newer) is run via a web browser, HOST will execute on the server and not the client machine.
    Without knowing exactly which Forms version you are using and where you want the call to be executed it will be difficult to offer suggestions.

  • How can i run a reports from forms

    Oracle forms 9i
    Hai All
    I am using oracle forms 9i.
    From the forms i need to generate a reports how can i generate a reports from there
    Regards
    Srikkanth.M

    there are hundreds of examples in this forum. Do a search

  • Firefox does not load the first time I click on it -- a script appears which ischrome://webvideodownloader/content/utils.js:131 -- when I stop this script running I can then load firefox -- how can I keep this script from running

    I can still load it with the script running or attempting to run in the background but it makes firefox tremendously slow. After I click on stop running the script then everything seems to be ok.
    how do I get the script not to run in the first place.

    In Firefox the use of the term chrome refers to the user interface and other elements that are not part of the web pages.
    See https://developer.mozilla.org/en/Chrome
    Your problems seems to be caused by the GreaseMonkey extension.<br />
    See [[Troubleshooting extensions and themes]]

  • How can I run a script last?

    Hiya,
    I have a single backup job running a single dataset. That single dataset has an include statement to include a dataset directory, which holds individual datasets for the several hosts I want to back up, each with potentially different parameters. This works well, the hosts back up in some order (I don't care), everything's happy.
    However, what I want to do is add a step on the end of this process to run a report on the admin server after all the backups are complete. That is, to run a script once, last.
    If I add an "after backup" command in the dataset, it runs it (as stated in the manual) on the client servers, after every backup, which is no good to me. I've tried creating a separate job and scheduling it at a lower priority a few minutes later than the backup job, but that seems to just run when it feels like it, I presume because there aren't any conflicts so why shouldn't it?
    Can anyone advise how I should be doing this?
    Related question... I've tried putting an "after backup" step on the Catalog backup job, but that appears to get run twice (I presume because there are two "include" steps in the catalog dataset)! Is this expected? How can I get it to just run once, after the catalog backup is complete?
    Thanks,
    David.

    Thanks Donna, but... no. It didn't work.
    We've actually purchased a license for OSB, so I've fired this question at our official support channel now, and they came back with the same answer at the same time (are you the Oracle techie looking at my problem, by any chance?). For the record here's (with some tweaks for readability in this context) what I've sent back in response to that article.
    From the article, I thought perhaps the following might do the trick:
    include dataset /Hosts {
    after backup optional "/usr/local/osb/pre-n-post after-fsd-hosts mail"
    But, from the log:
    2010/11/05.07:26:58 trouble parsing dataset in FSdaily line 1 - open brace appears where not allowed (OB dataset mgr)
    "010/11/05.07:26:58 offending line is "include dataset /Hosts {
    2010/11/05.07:26:58 trouble parsing dataset in FSdaily line 3 - bad nesting (OB dataset mgr)
    "010/11/05.07:26:58 offending line is "}
    So it appears I’m not actually allowed to do that. I don’t understand why that would be.
    The only other idea I have is to include a dummy backup step, backing up something really small (because OSB won’t let you run a backup without backing anything up - sigh!), tack a script onto that, and hope like heck OSB decides that it should run that last. All the documentation I’ve read gives the impression that datasets are all about scope, not order, so I’m not altogether confident that this will work. In any case, it seems a pretty kludgy way of doing it! And, given the next paragraph below, I’m not all that sure it’ll work in any case.
    My idea of scheduling a catalog backup for five minutes later than the client backups, with a lower priority, so that it runs when the client backups finish, also has a flaw - if I use two tape drives in parallel, it runs the catalog job in parallel with the last client job, which is completely useless. I want to put on the end of the tape a backup of the catalog as at just after the client backups, so that in the case of a disaster I can restore that and I’ll be good to restore everything else.
    In addition to being completely useless for the purposes of putting an “after” catalog backup on the end of the tape, it’s also completely useless for the purposes of running a script last - I tried the following:
    include catalog {
    after backup optional "/usr/local/osb/pre-n-post after-catalog mail"
    This ran the pre-n-post script twice, once for each component of the catalog, which is altogether not what I want it to do.
    I can’t think of any way to achieve a catalog backup on the end of the script except for scheduling it for some time later and hoping the dataset backups always finish by then. Ugly.
    The only way I can think to achieve the run-a-script-last is to munge all the datasets together into one humongous dataset file, and do stuff as in the article to try to bend OSB to my will (again, hoping that OSB obeys the order of statements in the dataset). Which, when I’m given the ability to use “include dataset /Hosts” to make it easy to maintain, seems a bit of a mean trick to pull on me. And, again, with two tape drives available I’m not at all sure it’ll work in any case.
    I'll post further results as they come to light...
    David.

  • How Can I run a script to all servers in my servers list

    Hi Guys
    I have a Servers list:servers.txt , it's including all servers i need to run a powershell script,how can I use the powershell to run a script on those servers? thank you.I just start to learn about powershell.

    You can pipe the results of Out-Command to Out-File (or Export-Csv, etc.)  I'm not sure what kind of objects you're expecting from this script, so I'll err on the side of caution and use Format-List * in the example:
    Invoke-Command -ComputerName $servers -FilePath c:\copy.ps1 |
    Format-List -Property * |
    Out-File -FilePath $home\Desktop\copy.log

  • Running Unix script from stored procedure

    At present, I run a unix script to export my data for backup using telnet. I would like my users to run the commands on their own without my help. My users do not know telnet (they have no IT knowledge). So, I plan to create a form using Developer/2000 and let them run the procedure thru a stored procedure.But, my problem is how can a stored procedure call a unix script?

    Hi,
    solution, used by me.
    Create a stored procedure that produces a text file with utl_file. The content of the file is the script you want to execute on your Unix box.
    On your Unix Box write a shell script that scans the utl_file_dir for Files. If a file is in, chmod 744 to grnt execute rights to it and execute it.
    I have a example if you want.
    Start the script with crontab or let it loop with a sleep inside.
    HTH
    Detlev

  • How can I run a script when an application quit??

    Greetings all,
    I'm trying to write a script, which can be triggered automatically (to do some stuff) at the time when a given application quit. I was playing around with this test script, taking "TextEdit" as an example - it just prints a message when TextEdit exits.
    ==========================================
    +*set targetapp to "TextEdit"*+
    +*tell application "System Events" to set rr to name of the processes*+
    +*--if targetapp is not in rr then*+
    +*-- tell application targetapp to activate*+
    +*-- tell application "System Events" to set rr to name of the processes*+
    +*--end if*+
    +*set rr1 to rr*+
    +*repeat until rr1 ≠ rr and targetapp is not in rr1*+
    +*tell application "System Events" to set rr1 to name of the processes*+
    +*do shell script "sleep 1"*+
    +*end repeat*+
    beep
    +*display dialog (targetapp & " is not active anymore !") as string buttons {"OK"} default button 1 with icon 0*+
    ============================================
    Unfortunately, it seems to work if I launch TextEdit using the script itself; it doesn't work with first +*"if - end if"*+ block commented out. Does anyone know how can I achieve this? Any help or suggestion greatly appreciated. Cheers!!

    Hi santanu,
    I'm sure you can use a variation of this application of mine to do what you want. It monitors all running processes and then reports when one closes.
    --initialize previous_processes
    global previous_processes
    tell application "Finder"
    set previous_processes to get the name of every process --use "whose visible is true" to remove the background ones
    end tell
    --monitoring script
    on idle
    tell application "Finder"
    set current_processes to get the name of every process
    end tell
    set numberofprocesses to count of items in previous_processes
    set counter to 1
    repeat while counter is less than (numberofprocesses + 1)
    if current_processes does not contain item counter of previous_processes then
    display alert item counter of previous_processes & " quit!"
    end if
    set counter to counter + 1
    end repeat
    set previous_processes to current_processes
    return 1 --runs every second...can be changed
    end idle

  • How can I run a script on suspend/resume?

    I'd like to run a script when a machine is about to suspend and another after it resumes. Is this possible?

    You can pipe the results of Out-Command to Out-File (or Export-Csv, etc.)  I'm not sure what kind of objects you're expecting from this script, so I'll err on the side of caution and use Format-List * in the example:
    Invoke-Command -ComputerName $servers -FilePath c:\copy.ps1 |
    Format-List -Property * |
    Out-File -FilePath $home\Desktop\copy.log

  • Can "Planners" run calc script from the Planning web?

    This is probably a really naive question.
    However, can planners run a simple calc script(created in Essbase/AAS) from Workspace/Planning Web? If so what access would they be need to setup in Shared Service?
    Or do we have to convert the calc script into a Business Rule and then grant access to the users?

    John,
    Here are the roles that i assigned my user and he can view/launch the calc scripts from Planning Web without actually being an admin( i think)
    Analytic Servers : server access
    Business Rules: Administrator
    Planning App : Interactive User
    APS : Provisioning Manager
    I would also like to conver the calc script to a BR as suggested, but not sure why i see no users available in the Business Rules-> administration tab.
    As indicated above, the use has been provisioned as a BR admin!
    Also, i tried refreshing the app with filters, refreshing the user list from BR->admin(right mouse), de-provision and re-provision the user! Any ideas??

  • ID CS5 on Mac 10.5.8 can't run java scripts from User folder

    I seem to have a problem with my java scripts in ID on my Mac. I store them in my user scripts folder, but while I can run any applescripts in the folder, doubleclicking on any of the java scripts gets me exactly nothing. If I open the scripts in Extend Script Toolkit and run them from there, they will work, but I can't run them from within ID. The scripts in the Sample Script folder work. I've tried changing the script extentions, I've opened them in the toolkit and resaved them. Still no response at all when I doubleclick on them in the scripts panel. Any idea what could be wrong? I can run the same scripts from within ID on my Windows laptop, so I don't think the scripts themselves are at fault. In fact, I just moved them into the Sample scripts folder, and they run with no problem. Does the User script folder just not work?

    Not sure what a screenshot will tell you, but here you go.
    Well, I was hoping that the icon next to the scripts would be instructive.
    Apparently not, though!
    You said the same scripts work fine if you move them into the Application Scripts folder, specifically the Sample Scripts folder. I assume, then, that the sample scripts also break if moved to the User Scripts folder?
    Is your User Scripts folder (and thus your home directory) on a non-local (network) filesystem? Are the permissions on it wacky? If you Reveal In Finder it, and Get Info, do you see anything out of the ordinary?
    What if you delete it (err, move it aside) and recreate it?
    This seems pretty strange...

  • How can I run an applet from an application (frame)?

    I have an application (frame) that render images and save it, and then I want to create an animation with those images using Animator applet from the application itself, but I do not how to call the applet from the application, is this possible?
    Thanks in advance, Jorge

    You can simply run a JApplet in a JFrame. Just create a frame object, an object of your applet, add the applet to the frame and call the init() function of your applet. It could look like this:
    JFrame anyFrame = new JFrame("MyTitle");
    YourApplet yourApplet = new YourApplet();
    anyFrame.getContentPane().add(yourApplet, BorderLayout.CENTER);
    yourApplet.init();
    anyFrame.setSize(new Dimension(800,600));
    anyFrame.setVisible(true);
    You will not necessarily have to write the applets default constructor.

Maybe you are looking for

  • How do i get rid of price finder pop ups on my mac?

    I am getting price finder pop ups every time in shopping on line or even just browsing the web. Does any body know how to get rid of the price finder pop ups?

  • Downloaded Adobe Reader to I Pad 2. The PDF file is still not opening.

    This is what the file says when I attempt to open it. I copied the first web link and downloaded Adobe Reader from there. Please wait... If this message is not eventually replaced by the proper contents of the document, your PDF viewer may not be abl

  • Smart Playlist bug?

    Anyone else having this problem? My music library consists of primarily contemporary Christian music. I attempted to set a Smart Playlist that would auto update music selections in two genres of music, "Gospel" and "Gospel & Religious" as per the alb

  • Variable length playlist to fill remaining space on iPod?

    My Nano always has some room left after I've synced my selected playlists. Is there a way to get iTunes to fill the remaining space on the Nano - perhaps using a variable length smart playlist? (I know I could create one giant playlist that draws fro

  • Flash player 10.3.181.14 broke my site, loading multiple swfs into an array

    I load multiple swfs into an array, I add and remove the objects on the stage, this is for a rotating carousel. All the items locations are established in xml. If I only have one item loaded into the array it works fine, if I have more then one it wi