Write a BASH script that kills a bunch of processes
Posted on 2011-09-20
I have a script that launches a bun of PHP scripts that run as Daemons (yes they really do). However the only way I can kill them is to do a px as | grep script.php and then kill the process ID.
The scripts when they launch store the PID in a subfolder of the same name in a file of the same name with a .pid extension.
I am trying to figure out how to write a BASH script by scanning all the subfolders of the current directory, getting the PID from a file and then killing the process. I have tried something like this but it didn't work as expected:
cat */*pid | xarg kill -9