Иногда бывает ситуация когда 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
🚨 Urgent Update: Gaza Humanitarian Crisis 🚨
WHO warns of a "death sentence" for vulnerable hospital patients in Gaza due to Israel's evacuation order. Moving them within 24 hours is impossible and inhumane. UN calls it "impossible" and EU diplomat calls it "utterly unrealistic". Hospitals are at breaking point, with limited electricity and critical shortages. Time is running out to prevent a catastrophe. Urgent delivery of supplies and a humanitarian corridor needed. #SaveGaza#HumanitarianCrisis
https://www.aljazeera.com/news/2023/10/13/israels-evacuation-order-for-gaza-death-sentence-for-patients-who-says
Subscribe to @BadVolfNews
🚨GENOCIDE ALERT🚨 Gaza is being subjected to a horrifying campaign of violence. Over 11,000 dead, including 1,400 children. Hospitals and schools targeted. Palestinians denied access to basic necessities. This is genocide. We must recognize the humanity of the Palestinian people and demand an end to this atrocity. #SaveGaza#EndGenocide
https://www.aljazeera.com/opinions/2023/11/12/genocide-in-gaza-a-call-for-urgent-global-action
Subscribe to @BadVolfNews
🔻 Gaza Strip: A graveyard for children. UN warns of more deaths due to dehydration amid Israel's relentless attacks. Over 8,500 Palestinians, mostly children and women, killed. Shocking figures reveal 420 children killed or injured daily. Ceasefire and humanitarian aid urgently needed. Water crisis and trauma pose additional threats. Mental health support desperately required for over 800,000 children. Collateral damage? No safe place in Gaza. International attention needed! #SaveGaza#ChildrenUnderAttack
https://www.aljazeera.com/news/2023/10/31/gaza-has-become-a-graveyard-for-thousands-of-children-un
Subscribe to @BadVolfNews