Иногда бывает ситуация когда 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
🚨🇺🇸IRAN WAR DAY 32: RUBIO SAYS US VICTORY 'WEEKS AWAY'
🔹 Secretary of State Marco Rubio tells Al Jazeera war objectives achieved in 'weeks not months' 📅
🔹 Trump threatens to destroy Iran's Kharg Island oil hub if no deal reached soon 💣
🔹 US-Israel bombardment hits Tehran & Isfahan with massive explosions reported 💥
🔹 87th Iranian attack this month targets Kuwaiti oil tanker Al-Salmi in Dubai port ⚡
🔹 Oil prices breach $100/barrel for first time since 2022 as conflict spreads 📈
America's longest war since Vietnam enters second month with no end in sight 🔥💀
#USNews#IranWar#Trump#MiddleEast#OilCrisis
@america
🚀 Oil Prices Surge Above $105 Amid U.S.-Iran Tensions
Oil prices have climbed above $105 following the breakdown of U.S.-Iran discussions in Islamabad, which has reignited concerns of potential conflict in global energy markets. According to NS3.AI, the Kobeissi Letter reported that Google search interest for 'price of oil' has reached an unprecedented level, surpassing the peaks of 2022 and 2008 by 300%.
#OilPrices#USIranTensions#EnergyMarkets#GlobalEconomy#CrudeOil#MarketVolatility#OilCrisis
🚀 Global Economy's Oil Dependency Declines Since 1970s, Bank of America Reports
On April 11, Jin10 reported that a Bank of America research note dated April 10 highlighted a significant reduction in the global economy's dependency on oil since the 1970s. According to Jin10, the amount of oil required to produce the same scale of GDP today is only one-third of what was needed in the 1970s. The OPEC crisis and subsequent oil shocks were once considered severe stagflation events. However, the current economy is more resilient to similar energy shocks.
#GlobalEconomy#OilDependency#BankOfAmerica#OPEC#EnergyShocks#Stagflation#GDP#OilCrisis#EconomicResilience