How to know, when a shell command running in the backround getting killed or died

fortune

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=${!}" 
Hauke Laging

If there is nothing to be done after curl:

while true; do
  avconv ... &
  curl ... "pid=${!}"
  wait $! && break
done

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How to know when my app has been killed?

From Dev

WMI:Getting Invalid Class Error when running shell command through another program

From Dev

how to know which SHELL is currently running?

From Dev

How to know which process died when monitoring two processes in while loop

From Dev

How can I make sure a program is killed when VPN is running?

From Dev

'command not found' error when running shell script

From Dev

How to identify if a long-running process died?

From Dev

Android: Wrong icon on header, when app is running in backround

From Dev

Android: Wrong icon on header, when app is running in backround

From Dev

Shell know if minecraft is running or not

From Dev

How does the `w` command know the idle time and the running command?

From Dev

How do I know if one of my RAID 1 drives died?

From Dev

What exactly determines if a backgrounded job is killed when the shell is exited, or killed?

From Dev

How to know when a tar command finished?

From Dev

How to tell if a systemd-run service was killed/died versus exiting normally?

From Dev

NodeJS Script killed by SIGKILL when running on Forever

From Dev

How to know the process of the terminal which is running in Linux command?

From Dev

Bad file descriptor when running cat command in a shell

From Dev

Unable to write to file in shell script when running command in background

From Dev

Error when running shell command in C++ ubuntu linux

From Dev

Getting gcc command not found when running the Makefile on travis CI

From Dev

getting "ksh: no space"-error when running a unix command

From Dev

Getting the functionality of the scrapy crawl command when running a spider from a script

From Dev

Getting gcc command not found when running the Makefile on travis CI

From Dev

Getting the functionality of the scrapy crawl command when running a spider from a script

From Dev

Getting error ": command not found" when trying to run shell script

From Dev

How to check if thread is killed or keep running when you stop the tomcat Server?

From Dev

how to get process status ( running , killed ) event?

From Dev

Long-running R script is getting killed automatically

Related Related

  1. 1

    How to know when my app has been killed?

  2. 2

    WMI:Getting Invalid Class Error when running shell command through another program

  3. 3

    how to know which SHELL is currently running?

  4. 4

    How to know which process died when monitoring two processes in while loop

  5. 5

    How can I make sure a program is killed when VPN is running?

  6. 6

    'command not found' error when running shell script

  7. 7

    How to identify if a long-running process died?

  8. 8

    Android: Wrong icon on header, when app is running in backround

  9. 9

    Android: Wrong icon on header, when app is running in backround

  10. 10

    Shell know if minecraft is running or not

  11. 11

    How does the `w` command know the idle time and the running command?

  12. 12

    How do I know if one of my RAID 1 drives died?

  13. 13

    What exactly determines if a backgrounded job is killed when the shell is exited, or killed?

  14. 14

    How to know when a tar command finished?

  15. 15

    How to tell if a systemd-run service was killed/died versus exiting normally?

  16. 16

    NodeJS Script killed by SIGKILL when running on Forever

  17. 17

    How to know the process of the terminal which is running in Linux command?

  18. 18

    Bad file descriptor when running cat command in a shell

  19. 19

    Unable to write to file in shell script when running command in background

  20. 20

    Error when running shell command in C++ ubuntu linux

  21. 21

    Getting gcc command not found when running the Makefile on travis CI

  22. 22

    getting "ksh: no space"-error when running a unix command

  23. 23

    Getting the functionality of the scrapy crawl command when running a spider from a script

  24. 24

    Getting gcc command not found when running the Makefile on travis CI

  25. 25

    Getting the functionality of the scrapy crawl command when running a spider from a script

  26. 26

    Getting error ": command not found" when trying to run shell script

  27. 27

    How to check if thread is killed or keep running when you stop the tomcat Server?

  28. 28

    how to get process status ( running , killed ) event?

  29. 29

    Long-running R script is getting killed automatically

HotTag

Archive