CJ H · Jan 9, 2018

How to kill a process spawn from $zf(-2)

I use zf(-2) to spawn a external a Java application in a *nix instance.

I would like to kill this process after some conditions met.

I would like to leverage $zf("kill ... ") but this requires its the pid of this child process.

So is there a way to acquire the pid for the child process when I create it ?

If not, how is the suggested way to kill this process?


0 291
Discussion (1)1
Log in or sign up to continue

You can add an argument to $zf(-2) such that the child PID is returned in $ZCHILD. This is documented here. For reference:

s rc=$zf(-2,"program","","",1) 
s childpid=$ZCHILD