Skip to main content
replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
Source Link

The following will kill the process group when the nc ends

#!/bin/sh
avconv x y z | sox a b c | { nc somewhere port ; pkill -g 0 ; }

Depending on how this gets started you might need to use a utility like setsid to restrict the things which are in the group. You could also replace -g 0 with -P $$. This works by the shell running the pkill command after the nc finishes.

See also Kill all descendant processesKill all descendant processes

The following will kill the process group when the nc ends

#!/bin/sh
avconv x y z | sox a b c | { nc somewhere port ; pkill -g 0 ; }

Depending on how this gets started you might need to use a utility like setsid to restrict the things which are in the group. You could also replace -g 0 with -P $$. This works by the shell running the pkill command after the nc finishes.

See also Kill all descendant processes

The following will kill the process group when the nc ends

#!/bin/sh
avconv x y z | sox a b c | { nc somewhere port ; pkill -g 0 ; }

Depending on how this gets started you might need to use a utility like setsid to restrict the things which are in the group. You could also replace -g 0 with -P $$. This works by the shell running the pkill command after the nc finishes.

See also Kill all descendant processes

Source Link
icarus
  • 19.1k
  • 1
  • 42
  • 57

The following will kill the process group when the nc ends

#!/bin/sh
avconv x y z | sox a b c | { nc somewhere port ; pkill -g 0 ; }

Depending on how this gets started you might need to use a utility like setsid to restrict the things which are in the group. You could also replace -g 0 with -P $$. This works by the shell running the pkill command after the nc finishes.

See also Kill all descendant processes