Иногда бывает ситуация когда 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
🌍 Some biodiversity hotspots, like the Cape Floristic Region in South Africa, pack over 9,000 plant species into just a tiny area—nearly 70% found nowhere else on Earth. ✨
#biodiversity⚡#plants⚡#hotspots⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌍 The Sundaland region in Southeast Asia is a biodiversity hotspot where over 15,000 plant species are found, nearly half of which exist nowhere else on Earth. ✨
#biodiversity⚡#hotspots⚡#conservation⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌍 The Western Ghats in India hold more amphibian species than all of Europe, packed into a narrow mountain strip. This biodiversity hotspot shelters ancient frogs found nowhere else on Earth. ✨
#biodiversity⚡#hotspots⚡#amphibians⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌍 New species are still being discovered in biodiversity hotspots like the Eastern Himalayas, where over 350 new plants and animals have been found in just two decades. ✨
#hotspots⚡#species⚡#discovery⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels