Иногда бывает ситуация когда 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
📢 Russian military spokesperson claims victory over Ukrainian forces on the Southern Donetsk front. Enemy rotation disrupted, personnel and equipment destroyed. Counter-battery strikes hit enemy positions. Significant losses reported. The conflict in Ukraine remains unresolved. #WarUpdates
https://www.gazeta.ru/army/news/2023/11/05/21644377.shtml
Subscribe to @BadVolfNews
📢 Russian forces strike Ukrainian military targets! Over 160 hits on Krasnolimansk direction. Artillery units neutralized, assault squads defeated. Support from air and artillery. Command and observation posts attacked. New tactics observed by Ukrainian forces. #WarUpdates
https://www.gazeta.ru/army/news/2023/11/02/21625465.shtml
Subscribe to @BadVolfNews
📣 Russian troops seize Ukrainian stronghold near Ugledar in Donetsk People's Republic. 10 enemy soldiers caught off guard, 4 taken captive. Clever tactics employed, with one group approaching from the front and another from the rear. Victory for Russian forces! 💪🇷🇺#WarUpdates
https://www.gazeta.ru/army/news/2023/11/01/21617965.shtml
Subscribe to @BadVolfNews
📢 Russian forces gaining ground, Ukraine struggling to hold on. White House speculates Russia will secure tactical victories, cementing their dominance by spring. Crisis of conscription and dwindling weapon supplies weaken Ukraine's chances. Advisor warns Ukraine may not last till spring. Russian military holds the offensive initiative, pushing forward with success. Ukrainian strongholds predicted to fall, leading to a domino effect as the enemy flees. Official admits futility of fighting, claims US and Europe have abandoned Ukraine. US identifies major threats to Ukrainian Armed Forces. #WarUpdates#Ukraine#Russia
https://www.gazeta.ru/army/news/2023/10/28/21595081.shtml
Subscribe to @BadVolfNews
Ukraine’s paratroopers clear Berezove in Dnipropetrovsk Oblast, completing near-total reversal of Russia’s 2025 gains in the region
[Read FullArticle]
@WorldNews#UkraineNews#WarUpdates#DnipropetrovskIf
@syrianaanalysis breaks down Israel's strikes on Syria with Red Pilled, exploring how regional tensions are escalating and what it means for the axis of resistance.
#Israel#Syria#Hezbollah#MiddleEast#Gaza#WarUpdates#PoliticalAnalysis