Skip to content

Instantly share code, notes, and snippets.

@Nex-Otaku
Last active March 16, 2021 12:42
Show Gist options
  • Save Nex-Otaku/05148755308f6d47138c63731567667e to your computer and use it in GitHub Desktop.
Save Nex-Otaku/05148755308f6d47138c63731567667e to your computer and use it in GitHub Desktop.
Bash script to stop Yii server
#!/bin/bash
YII_SERVER_PGID=$(ps x -o pgid,command | grep -v grep | grep "/vendor/bin/yii serve" | awk '{print $1;}')
if [[ -z "$YII_SERVER_PGID" ]]; then
echo "Yii server not running."
else
kill -TERM -- -$YII_SERVER_PGID
echo "Killed Yii server."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment