Иногда бывает ситуация когда 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
🚨🔫WHCD SHOOTER PLANNED TO TARGET TRUMP OFFICIALS
🔹 Cole Allen, 31, rushed security with shotgun, handgun, and knives at Washington Hilton 🔪
🔹 California teacher wrote "Administration officials are targets" minutes before attack 📝
🔹 Traveled by train from LA to DC, checked into hotel days before correspondents' dinner 🚂
Allen apologized to family but called it his "duty" to target high-ranking officials — except FBI Director Kash Patel 🎯⚖️
Security nightmare: How did he get so close to the President? 😰🛡️
📊 The numbers don't lie. Stay tuned for updates 📱
🌍 This affects more people than you think 📲
#WHCD#Security
@america
🎩🚨MENTALIST RECALLS "ARE WE ABOUT TO DIE?" MOMENT BESIDE TRUMP
🔹 Oz Pearlman was mid-magic trick guessing press secretary's baby name when gunshots erupted at 8:36pm 🍼✨
🔹 Secret Service tackled both performer and president to ground — "his eyes weren't registering," Pearlman says 👁️😰
🔹 Found himself lying half-meter from Trump after meeting him just 5 minutes before the chaos began 📏⏰
🔹 Describes surreal terror of life-threatening moment at what should have been elegant dinner event 🍽️💔
"Split second after my trick reveal, everything went to hell" — witness account chills 😨❄️
This is Hollywood-level crazy but it's real life 🎬😱
#WHCD#performer#witness#security
@america