Иногда бывает ситуация когда 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
🌎 Mosquitoes are responsible for more human deaths than any other animal on Earth. They transmit diseases like malaria, dengue, Zika, and yellow fever, causing over 700,000 deaths each year worldwide. Some mosquito species can breed in just a bottle cap of water. ✨
#animals⚡#danger⚡#mosquitoes
👉subscribe Interesting Planet
👉more Channels
🌎 Mosquitoes are considered the most dangerous animals on Earth because they transmit deadly diseases like malaria, dengue, and Zika virus. Malaria alone causes more than 600,000 deaths annually, making mosquitoes responsible for more human deaths than any other animal. ✨
#mosquitoes⚡#disease⚡#animals
👉subscribe Interesting Planet
👉more Channels
Scientists have confirmed the first mosquitoes found in Iceland. This discovery is notable because Iceland’s cold climate previously prevented mosquitoes from establishing there.
🦟🔍👏
[Read more]
[Source picture]
@googlefactss
#Mosquitoes#Iceland#Ecology#Science