IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

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

cannot execute command with executeOSCommand service.

  • 1.  cannot execute command with executeOSCommand service.

    Posted Fri April 27, 2012 07:38 AM

    Hi All,
    I have a requirement of executing UNIX commands on system for which I am using PS utilities executeOSCommand service.
    but when I try this command
    find . -mtime +10 -type f -exec cp {} \ directory-name ;
    I don’t get any results.
    My reqmt is to find all the files last modified 10 days ago and copy them to the specified directory.


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


  • 2.  RE: cannot execute command with executeOSCommand service.

    Posted Mon April 30, 2012 11:06 AM

    Hello,

    Please send a screenshot of the input of the service.
    You cannot put all the command in the “command” field. You have to make use of the parameters.

    If you can’t get what you want, then I suggest just creating a shell script on Unix Filesystem and then just call the shell script from the ExecuteOSCommand service…

    Jeremy


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


  • 3.  RE: cannot execute command with executeOSCommand service.

    Posted Thu May 03, 2012 06:45 AM

    Hi Jeremy,
    Executing commands in a script worked!!!
    thanks


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


  • 4.  RE: cannot execute command with executeOSCommand service.

    Posted Tue January 06, 2015 03:00 AM

    Hello, All
    I want to invoke the service ps.util.system:executeOSCommand to execute the Linux command "mv /tmp/test/.csv /tmp/test/bak/" , the inputs of the service as follow:
    command: mv
    arguments: (1)/tmp/test/
    .csv
    (2)/tmp/test/bak/
    workingDirectory: /tmp/test/

    An error “mv: cannot stat `/tmp/test/.csv’: No such file or directory" happened, would you tell me how to convert the character "” on this service ? or this service can’t be used like this ?

    I create a shell script on Unix Filesystem and then just call the shell script from the ExecuteOSCommand service, it is OK by this way.


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


  • 5.  RE: cannot execute command with executeOSCommand service.

    Posted Tue January 06, 2015 05:27 AM

    Hi Xing,

    Did you check whether the command which you are trying to execute is exist as part of OSCommands.cnf file …

    Thanks,


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


  • 6.  RE: cannot execute command with executeOSCommand service.

    Posted Tue January 06, 2015 08:48 AM

    Try giving the complete string in the cmd itself.

    command: mv /tmp/test/*.csv /tmp/test/bak/

    as you are giving the complete path right from the root folder, you need not give the workingDirectory also.
    No arguments. Just command string.

    /Naidu


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


  • 7.  RE: cannot execute command with executeOSCommand service.

    Posted Tue January 06, 2015 10:09 PM

    I give the complete string “mv /tmp/test/*.csv /tmp/test/bak/” to command only, but the error keeps the same.


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


  • 8.  RE: cannot execute command with executeOSCommand service.

    Posted Tue January 06, 2015 10:36 PM

    Hi,
    I checked the file /webMethods/webMethods9/IntegrationServer/packages/WmPublic/config/OSCommands.cnf as below:
    allowedOSCommands=mv
    allowedWorkingDirectories=/webMethods/SISHARE/SLS/test/

    but the error of “mv /webMethods/SISHARE/SLS/test/*.csv /webMethods/SISHARE/SLS/test/bak” keep the same.

    I can touch a file named “*.csv” on the linux, so I doubt that the * can’t be used as a wildcard on this service, but how can I use the * as a wildcard like linux command or is it not supporting this function ?

    Thanks !


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


  • 9.  RE: cannot execute command with executeOSCommand service.

    Posted Tue January 06, 2015 10:56 PM

    Hi Xing,

    Can you please give a try like below :

    mv /tmp/test/‘*.csv’ /tmp/test/bak/

    and let us know what you have observed. At present i don’t have Unix/Linux OS to execute n give you right command in a single short.

    Thanks,


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


  • 10.  RE: cannot execute command with executeOSCommand service.

    Posted Tue January 06, 2015 11:13 PM

    Hi MR,

    command: mv /tmp/test/‘*.csv’ /tmp/test/bak/
    the actual filename is abc.csv

    The result as following attachment:
    errorMessage: mv: cannot stat `/tmp/test/'*.csv'': No such file or directory.


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


  • 11.  RE: cannot execute command with executeOSCommand service.

    Posted Wed January 07, 2015 10:52 AM

    Please use pub.utils:executeOSCommand which is in WmPublic instead of PSUtilities.

    Refer BIS for the usage guidelines.


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


  • 12.  RE: cannot execute command with executeOSCommand service.

    Posted Wed January 07, 2015 11:40 PM

    Hi?M@he$h?
    Thanks for your reply.

    The service pub.utils:executeOSCommand still can’t identify that the “" is a wildcard or only a common character, so when I want to use ".csv” to filter files “A.csv” and “B.csv”, the command "mv /tmp/test/.csv /tmp/test/bak/" is failed. errorMessage: mv: cannot stat ` /tmp/test/.csv’': No such file or directory. I had tried to use “." or others instead of "”, but it is bad. What can I do for it ?


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


  • 13.  RE: cannot execute command with executeOSCommand service.

    Posted Thu January 08, 2015 05:49 PM

    you can use: pub.file:listFiles service under WmPublic
    to list all files under the directory and copy them one by one.
    HTH,


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