Using Result of ps with –no-headers to Kill Orphaned Daemon Processes

In echonest adventures with the Forever.fm codebase, in development I was starting and stopping the parent process over and over and over with command-C, which ended up filling the swap memory with orphaned ffmpeg processes.

The following code almost stopped them:

kill `ps -C en-ffmpeg -o ppid`

But returned an error because headers were also being offered to kill. This one did the trick:

kill `ps -C en-ffmpeg -o ppid --no-headers`