Иногда бывает ситуация когда 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
🪐 Hidden over 430 light-years away in the constellation Ophiuchus, the protoplanetary disk around the young star AS 209 is riddled with striking gaps and rings thought to be carved by newly forming planets. ALMA observations revealed the disk’s outermost gap may be created by a planet similar in mass to Neptune, astonishing astronomers because it would be forming over 200 astronomical units from its star—far beyond the realms where planets are usually born. ✨
#protoplanets⚡#ALMA⚡#Ophiuchus
👉subscribe Universe Mysteries
🪐 The black hole MAXI J1820+070, about 10,000 light-years away in the constellation Ophiuchus, is known for its rapid and dramatic changes in brightness. These "black hole outbursts" happen when the black hole pulls in matter from a companion star, causing huge X-ray flares as the material heats up and spirals inward—revealing just how active and unpredictable these cosmic giants can be. ✨
#blackhole⚡#xray⚡#Ophiuchus⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
🪐 A rogue planet called ISO-Oph 98, discovered in the Ophiuchus star-forming region about 475 light-years from Earth, is so light it’s only about 0.6% the mass of our Sun—closer to a giant planet than to a star. Unlike most planets, rogue planets like ISO-Oph 98 drift through space without orbiting any star, shining faintly with their own leftover heat rather than reflecting sunlight. ✨
#rogueplanets⚡#starformation⚡#Ophiuchus⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 The magnetar 1RXS J170849.0–400910, located about 18,000 light-years away in the constellation Ophiuchus, is known for its titanic magnetic field, which can reach over 100 trillion times the strength of Earth's. This intense magnetism is so powerful that it can twist the star's crust, triggering sudden bursts of X-rays and gamma rays—brief flashes that outshine entire regions of space before fading into darkness. ✨
#magnetar⚡#Xrays⚡#Ophiuchus⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels