Script to kill httpd processes

While server having heavy load and we want to stop or kill the httpd service on the server to reduce the server but its not stopping at that time, refer to the following script to kill the httpd process and its always better to save the script on the server, so that you can execute any time when you want to kill the httpd processes.

#!/bin/bash
for pid in `ps -C httpd|sed -e ‘s/^\ \+//g’ | grep httpd|awk ‘{print $1}’`
do
kill $pid
done

Make sure that you have assigned the execution permission to the script, so it won’t cause the permission error.

About Anant 386 Articles
Senior technical writer