Question
Ericsson
IN
Last activity: 19 Nov 2015 4:41 EST
Can we run UNIX commands like ‘chmod’ from a pega activity on a different server other than where pega is installed
Can we run UNIX commands like ‘chmod’ from a pega activity on a different server other than where pega is installed
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
GB
The remote server would require some sort of service that PRPC could connect to in order to do this.
Pegasystems Inc.
GB
Alternatively : you could perhaps use a third party Java Library to create SSH connections to the remove Unix host : for instance the JSch library...
Cheers
John
Ericsson
IN
Can you please give some more information on how to achieve this functionality.
like any OOTB feature or service or connectors that can be used to achieve this ..??
Pegasystems Inc.
GB
Hi Abhishek,
There is no OOTB CONNECTOR to provide 'SSH' Connectivity in PRPC. PRPC has REST, SOAP , HTTP, JMS CONNECTORs built-in - which in theory could be used to run remote Unix Commands - but in those cases you would need to construct a SERVICE on the UNIX machine to provide something for PRPC to connect to.
And third option (assuming PRPC is running in Unix Environment or at least has access to some Unix-like-facilities) would be to create a LOCAL script which makes the call to the Remote Unix Machine - which would involve having to setup (at the Unix Level) trusts (SSH Certificates for instance) between the Unix Machines.
Thinking about it: the third option is probably the best one - as it leaves the control/security in the hands of the Unix Admin : as far as PRPC is concerned it would be running a local script (which happens to make a connection to a remote machine).
Cheers
John
Ericsson
IN
Hi,
How should I proceed for this?
Like I want to connect the Server through an activity,
What are the rules that would be required to achieve this functionality other than the activity where I would have to use java method.
For POC purpose I will be connecting to a PMF server which is installed on a Unix server.
IF you have any java code snipper,kindly share that.
Thanks In advance
Ericsson
IN
Hi,
How should I proceed for this?
Like I want to connect the Server through an activity,
What are the rules that would be required to achieve this functionality other than the activity where I would have to use java method.
For POC purpose I will be connecting to a PMF server which is installed on a Unix server.
IF you have any java code snipper,kindly share that.
Thanks In advanc
Pegasystems Inc.
GB
Are you connecting one PRPC system to another ? If so - you should be able to use a combination of a PRPC SERVICE (on the remote system) and PRPC CONNECTOR (on the calling system).
On the Remote System: you should then be able to create an Activity (using Java Steps) that runs the script on the Unix machine.
You also might be better creating a 'polling' Unix Shell Script - which looks for a File being 'dropped' into a directory rather than going through all the messy Java Integration with OS commands.
(That is: just have PRPC create a file, and have the script periodically look for the file, carry out the actions and then delete the file or something like that).
Do you literally only need to call a 'chmod' command - or do you need to run an arbitary set of Unix Commands ?
If it's just a chmod - then consider setting up the 'umask' correctly on the Unix system such that files are automatically created with the required permissions.
OR : if you are using Java 7 - there are now some standard libraries for setting up POSIX permissions - see here for instance : https://docs.oracle.com/javase/tutorial/essential/io/examples/Chmod.java
Ericsson
IN
I came across this blog on this situation :