How to connect to an external server and execute shell script from Pega
Hi All, I need urgent help on this requirement.
Could anyone please tell me a way to establish connection with external server(Axiom server) and execute a shell script in that server.
As per my understanding the connect-ftp method using the ftp server instance can be used to connect to an external system and perform the file transfer. But in my requirement, Pega needs to connect to the axiom server and need to execute the script there.
Also I found the below java code to execute the shell script which seems to got deprecated in the latest Pega version(8.8.5). So request you share the steps/options to achieve the above mentioned requirement.
String[] command = {"/bin/bash", "test.sh", "Argument1"}; ProcessBuilder p = new ProcessBuilder(command); Process p2 = p.start(); BufferedReader br = new BufferedReader(new InputStreamReader(p2.getInputStream())); String line;
System.out.println("Output of running " + command + " is: "); while ((line = br.readLine()) != null) { System.out.println(line);
Error received while trying to run code:
Java code injection pattern identified in the java source code. Vulnerable code detected: newProcessBuilder(
Thanks in advance,
Sindhu S