I am running a shell command which is invoking an avconv session. The command is running as a background process. When the script starts executing I am doing a curl post to a url with the created process id. And that is working perfectly. But how can I do another curl post when the process getting killed or died?The script right now, I am running is:avconv -i rtsp://ipaddress/axis-media/media.amp -r 3 -g 3 -vcodec h264 -c:v libx264 -f mpegts udp://127.0.0.1:10000 & curl --request POST http://myipaddress/receivce.php --data pid=${!} 
How to know, when a shell command running in the backround getting killed or died
shell;background process
If there is nothing to be done after curl:while true; do  avconv ... &  curl ... pid=${!}  wait $! && breakdone