Иногда бывает ситуация когда 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
🌎 The Steller’s sea cow, a giant marine mammal, was discovered in the Bering Sea in 1741 and went extinct just 27 years later due to overhunting. This species reached lengths up to 9 meters and fed on kelp, leaving no close living relatives today. ✨
#extinction⚡#megafauna⚡#ocean
👉subscribe Interesting Planet
🌎 Ice Age cave lions once roamed across Europe and Asia, hunting mammoths and bison in frigid steppe. Larger than today’s lions, these extinct predators are known from beautifully preserved cave paintings and even mummified cubs found in Siberian permafrost. ✨
#paleontology⚡#megafauna⚡#prehistory
👉subscribe Interesting Planet
🌎 The Gomphothere, an ancient cousin of elephants, once roamed the Americas with shovel-shaped lower jaws. These extinct giants sported four tusks instead of two, thriving for millions of years before vanishing at the end of the last Ice Age. ✨
#paleontology⚡#megafauna⚡#extinction
👉subscribe Interesting Planet
🌎 Australian megafauna like Diprotodon, the largest marsupial ever, disappeared about 46,000 years ago. These giant wombat relatives weighed up to 2,750 kilograms. The cause of their extinction is debated—some studies suggest climate shifts, while others blame human hunting. Diprotodon fossils have been found at over 100 sites across Australia. ✨
#extinctanimals⚡#megafauna⚡#paleontology
👉subscribe Interesting Planet
👉more Channels
🌎 The mystery of the Irish elk lies in its enormous antlers, which could span up to 3.5 meters. Despite the name, it lived across Eurasia and wasn’t truly an elk. Fossils suggest it vanished about 7,700 years ago, possibly due to climate change and habitat loss at the end of the last Ice Age. ✨
#extinct⚡#paleontology⚡#megafauna
👉subscribe Interesting Planet
👉more Channels