Иногда бывает ситуация когда dev-сервер по какой-либо причине не закрылся и висит в процессах, занимая порт.
Это может быть из-за падения IDE или просто сам забыл погасить и закрыл терминал.
Для таких случаев я набросал простую функцию с командой:
kill_on_port() {
port=$(lsof -t -i:$1)
echo "KILL PROCESS:" $port
sudo kill -9 $port
}
alias killonport="kill_on_port $@"
Код поместить в ~/.bashrc и рестартнуть систему.
Если во время старта dev-сервера получаете ошибку что порт уже занят, просто выполните команду, подставив свой порт.
Bash
kill_on_port 8000
Скорее всего бесполезно, если другой процесс назначен на перезапуск вашего dev-сервера в случае падения.
Имя команды можете изменить на любое другое.
#linux
#HappyEaster from all of us at the Nigeria Centre for Disease Control and Prevention.
May this day fill you and your loved ones with joy, happiness, and renewed health.
Let's celebrate the gift of hope and good health as we strive towards healthy living.
The Nigeria Centre for Disease Control and Prevention (NCDC) wishes you a joyful and peaceful Easter. ✝️
As we celebrate this season of hope, renewal, and new beginnings, we are reminded of the importance of protecting our health and the wellbeing of those around us.
While you spend time with loved ones, remember to practice good hygiene, stay informed, and make choices that keep our communities safe.✅
May this Easter bring you renewed strength, happiness, and good health.
Stay safe, stay informed, and enjoy the season. 🌿
#HappyEaster#StayHealthy#NCDCNigeria