I started working on this recently and got into a trouble. Please help me on how to execute a shell script using a java service written in webMethods service development.
So far my progress is as follows:
I was able to login using ssh…verified on the unix shell and it is working.
I am unable to do the following.
cd to a specific directory and
invoke the shell script.
requirement was to cleanup all the logs in the IS’s each month after during restart . I have a unix script that has all the directories it need to go to and cleanup .This needs to be invoked without logging into the hosts and then traversing to the directory.My aim was to have a java service which can login to a unix host and then initiates that clean up script.
Coming backto my questions, Integration Server is totaled at 20. I will have a flow which will over write hostname and port that can login to all the different 20 hosts.
So will the script you are building with JS needed to be executed on one IS that will handle all the other OS machines hosted IS’s log files clean up? Is that that direction you are going with?
Yeh, why don’t you use WmPublic/pub.client.sftp service having with appropriate commands and manage the creds/path entries via a db?
Very true. I am trying to write this invokeOScommand service and place it on one box which then logs into other Integration servers(already shut) and cd to a directory where my cleanup script is residing. I do not know if i can use pub.client.sftp:cd,pub.client:sftp . I am not sure if these(pub.client…) will server my purpose of invoking a look alike of “sh cleanup.sh”
There is no other way , than to login to the unix box and invoke the shell script.
Also , the problem is i have to have elevated rights to execute this cleanup. Which i get through using “su -”. I am trying to acheive the following.
In sequential
login to the host-i got it completed
‘su-’ not able to complete
cd-not done
sh cleanup.sh-not done
Are you able to execute the operations manually (that is, opening an ssh session and sending each of the operations) from the machine where you have the IS?
Can you execute the same operation through a script on that machine?