In my situation, I have one shell script running rsync and tar in the background. Rsync is used to transfer files, and tar is doing compression after rsync is finished. My problem is how to monitor the pid of rsync, and tells tar command to start when the pid of rsync doesn't exists anymore.
The shell script may looks like this:
rsync data.log B/ &
tar data.tar.gz B/data.log &