Иногда бывает ситуация когда 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 world’s biggest human migration still happens every year in China, as hundreds of millions travel during Lunar New Year— the largest annual movement of people on Earth. ✨
#migration⚡#population⚡#movement⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌍 In 2022, the number of international migrants reached an estimated 281 million—more than triple the figure from 1970—making up 3.6% of the world’s total population today. ✨
#migration⚡#demographics⚡#movement⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌍 Since the 1990s, the number of people living outside their birthplace has more than doubled, with most international migration now happening between countries in Asia and Europe. ✨
#migration⚡#demography⚡#movement⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography🌍
🌍 Tokyo’s Shibuya Crossing is one of the busiest pedestrian intersections in the world, where as many as 3,000 people can cross with every green light, illustrating dense urban flow. ✨
#city⚡#infrastructure⚡#movement⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography🌍