Skip to content

Instantly share code, notes, and snippets.

@drazulay
Created April 4, 2024 17:53
Show Gist options
  • Save drazulay/262ffdb61e0c87862c391470b1eda752 to your computer and use it in GitHub Desktop.
Save drazulay/262ffdb61e0c87862c391470b1eda752 to your computer and use it in GitHub Desktop.
Kill all PHP-FPM instances running
killphp () {
printf "This will kill all PHP-FPM instances running. Continue (y/N)? "
read -q
if [[ $? -eq 0 ]]
then
for pid in $(ps aux | grep php-fpm | grep -v color | tr -s " " | cut -d" " -f2)
do
sudo kill -9 $pid
done
echo "\nall instances killed"
else
echo "\ncancelled"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment