webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Executing Unix script from webmethods

  • 1.  Executing Unix script from webmethods

    Posted Thu September 11, 2003 05:46 PM

    I’ve a situation where I need to run a Unix script from webMethods. How do I achieve this. Server may not be running on the same box or there may not be any IS on the box where the scripts reside. I should be able to invoke this remotely.

    Thanks,

    Venkat


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: Executing Unix script from webmethods

    Posted Thu September 11, 2003 06:43 PM

    You could do a java.lang.Runtime:exec() of SSH to the remote box and use SSH to execute your script.


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 3.  RE: Executing Unix script from webmethods

    Posted Thu September 11, 2003 09:46 PM

    Venkat, the solution can be found in this thread:
    [url=“wmusers.com”]wmusers.com

    Good luck!

    Wayne


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 4.  RE: Executing Unix script from webmethods

    Posted Fri September 12, 2003 07:55 PM

    Thanks Guys. That helped me. But I have another problem. The actual script to run is as follows.
    su - omidevl -c “/opt/omi/utility/scripts/uuts702 WPUJ130”.

    I had problems in java for the double quotes. I used the escape character and finally I could get the command string into the method. Runtime.getRuntime().exec().
    But it is not executing it and returns the code 0f 1.
    I added the string to the pipeline.
    When I copied the same and run on the console it runs fine.
    So, in Runtime.getRuntime().exec() method it is getting confused.

    Then I created another script to hold the entire command ran that script alone. It worked fine.

    But I want to know, why it is not working when I pass the whole string to exec() method.

    Thanks,

    Venkat


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 5.  RE: Executing Unix script from webmethods

    Posted Tue October 14, 2003 03:16 PM

    Ensure that you’re catching the stderr of the executable: see java.lang.Process (getErrorStream).

    There’s a post floating around on wmusers where this is discussed. I had a quick look through the archives but it wasn’t immediately obvious. If you can’t find it google on Runtime.exec(…) and look for discussions about using InputStreams to hook up to the stdout, stdin, and stderr or executables.

    Nick


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 6.  RE: Executing Unix script from webmethods

    Posted Wed January 07, 2004 05:32 PM

    Hi,

    I think you may be required to use escape \ for the quotes in your command.


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 7.  RE: Executing Unix script from webmethods

    Posted Thu October 23, 2008 04:08 PM

    hi,
    I am trying to run an unix script using webMethods.The command used is-

    bdf -l |awk ‘{print $1,$5,$6}’ >/packages/**/config/DiskMonitoring1.txt

    Currently i am getting this error–

    “bdf: |awk: No such file or directory
    bdf: ‘{print: No such file or directory
    bdf: $1,$5,$6}’: No such file or directory
    bdf: >/packages/***/config/DiskMonitoring1.txt: No such file or directory”.

    Any solution to this?

    Thanks,
    Aishvarya.


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 8.  RE: Executing Unix script from webmethods

    Posted Mon October 27, 2008 04:15 PM

    I believe it is due to your path structure - use …/ instead of / to begin your path…


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 9.  RE: Executing Unix script from webmethods

    Posted Tue October 28, 2008 10:46 AM

    can u explain it? dint get yur reply here…


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 10.  RE: Executing Unix script from webmethods

    Posted Tue October 28, 2008 03:15 PM

    Tell us more about how you are calling the unix script (are you using PSUtilities command line exec tool, are you calling it from your java script, etc)?

    The more detail you give, the more likely someone can help without just taking a guess - as I did last post. :slight_smile:


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 11.  RE: Executing Unix script from webmethods

    Posted Fri February 27, 2009 09:59 PM

    Venkat,
    we are facing similar problem…could you please let us know how you fixed the error.thanks


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services