Иногда бывает ситуация когда 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
🌍 Since the 1960s, Dubai’s desert coast has transformed into a global business hub through free trade zones, drawing global companies and turning once barren sands into a vibrant economic powerhouse. ✨
#economicgeography⚡#trade⚡#urbanization⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌍 The Chicago area is the world’s largest concentration of inland rail and freight connections, making it a vital hub where goods from coasts and the Midwest converge before heading nationwide. ✨
#economicgeography⚡#transport⚡#trade⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌍 More than half of global economic activity now takes place within just 1% of the world’s land surface, showing how powerful major cities and industrial regions are for global wealth. ✨
#economicgeography⚡#cities⚡#industry⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography🌍
🌍 Japan’s Tokaido corridor between Tokyo and Osaka packs over 60 million people and is a global hub for high-speed trains, industry, and services, shaping a megaregion central to Asia’s economy. ✨
#economicgeography⚡#megaregion⚡#infrastructure⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels