Иногда бывает ситуация когда 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
📍 Kruger National Park, South Africa 🇿🇦
🦁 Kruger National Park is one of the most famous safari destinations in the world. It is home to Africa's "Big Five": lions, elephants, buffalo, rhinos, and leopards 🐘. The vast area of the park allows you to see wild animals in their natural habitat, and the diverse landscapes, from savannas to forests, make every trip unforgettable. 🌿
🚗 Tourists can explore the park by car or go on an organized safari with guides. Exciting sunsets, rare bird species, and the opportunity to see African life up close make this place a true adventure. The park is open year-round and ready to give bright emotions to every visitor! 🦓
#travel#safari#wildlife
safari
noun
uk /səˈfɑː.ri/ us /səˈfɑːr.i/
an organized journey to look at, or sometimes hunt, wild animals, especially in Africa.
[Source] 🐒🦒🦏
@googlefactss
#Africa#safari