We have a java service built within the webMethods Integration Server 4.6 which is responsible to create an output file (text file) as the result of the processing. This service reads an input file (Delimite File format) and converts it to another format (XML), saving the output file in the server’s file system. The service works well and it sucesfully creates the output file, but the output file’s permission is set to the owner “root” and no other user is capable of read, move or delete the file. I need to know how to setup the file’s attributes to allow other regular users to access and move the files. It’s important to note that unix scripts and cronjobs in Unix regularly uses regular users to login into the machine in order to perform their job. If webMethods creates files using the original startup user (in our example is alway “root”), then consequently all the output files created by webMethods belong to “root”. How can we change and manipulate the output files’ attributes? Pls, advise. Thanks!
Waldes, we have used the Java classes Process and Runtime along with the Unix command chmod to set file privileges within webMethods Integration Components.
Process pgrant = Runtime.getRuntime().exec("chmod 777 "+ fileName);
You could write a Java service to run chmod or chgrp or any other Unix command. Obviously you would dynamically build your command String instead of hardcoding it
Hope this helps.
I think we also ran into same problem at another client and as a quick fix we ran the batch file at the end of the day to change the permissions of files. Or I guess you can create another user with in the same group as root and then install the IS as that user. may be that can solve your problem.
It works! Thanks a bunch! The developer only needs to make sure he/she imports java.io.* and it should be done deal. We could also use for other unix commands as well (such as chown). The tip about avoiding hard code stuff also helped. Appreciate!