Hello,
I am building a BPMN which triggers an api to clone a machine ( using camunda connect). This is working fine and the cloning process starts.
I have written a shell script to monitor that the machine has become live after cloning
#!/usr/bin/bash
while ! timeout 1 bash -c “echo > /dev/tcp/$1/22”; do
sleep 1
doneecho “up”
This is a script task in groovy, meaning I call this shell script from groovy
static void main(String[] args) {
def sout = new StringBuilder(), serr = new StringBuilder()
def ip = execution.getVariable(“field_private_ip”)
def cmd = ["/opt/gasf/scripts/wait_for_cloning.sh", ip]
println “Command:$cmd”
def proc = cmd.execute()
proc.consumeProcessOutput(sout, serr)
proc.waitForOrKill(1000)
println “out> $sout err> $serr”
sout
The shell script that I am calling technically waits till it is able to establish connection and only then returns a value.
When I run this via the process engine, the script task is triggered and passes to the next task.
Is there a way that I could make execution wait at this script task until it is successful ?
Advice would be much appreciated.