Иногда бывает ситуация когда 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
✨️ On the occasion of National Unity Day, the Embassy of Russia in Pakistan in cooperation with Observer Diplomat has prepared a special magazine dedicated to the holiday
🔗 Read now: t.ly/oj2Yx
#UnityDay2024
🇷🇺 Today #Russia and its people celebrate national #UnityDay!
The day symbolizes the unity of our multiethnic peoples, celebrates our diversity in unity and our unerring devotion to the Motherland.
❗️ Happy #UnityDay!
#UnityDay2024#TogetherForever
🇷🇺 Today #Russia and its people celebrate national #UnityDay!
The day symbolizes the unity of our multiethnic peoples, celebrates our diversity in unity and our unerring devotion to the Motherland.
❗️ Happy #UnityDay!
#UnityDay2024#TogetherForever
🇷🇺 Today #Russia and its people celebrate national #UnityDay!
The day symbolizes the unity of our multiethnic peoples, celebrates our diversity in unity and our unerring devotion to the Motherland.
❗️ Happy #UnityDay!
#UnityDay2024#TogetherForever
🇷🇺 Today #Russia and its people celebrate national #UnityDay!
The day symbolizes the unity of our multiethnic peoples, celebrates our diversity in unity and our unerring devotion to the Motherland.
❗️ Happy #UnityDay!
#UnityDay2024#TogetherForever