How to solve when port is already occupied(ERPNEXT 15 on Ubuntu 24)

I have already deployed ERPNEXT 15 on development mode and tried to set it on deployment mode. I have already reverted the changes I did when deploying but now when I tried to do this:

Command:
bench start

Error message:


03:32:22 system        | redis_cache.1 started (pid=28059)
03:32:22 system        | redis_queue.1 started (pid=28057)
03:32:22 system        | web.1 started (pid=28058)
03:32:22 system        | socketio.1 started (pid=28060)
03:32:22 system        | watch.1 started (pid=28063)
03:32:22 redis_cache.1 | 28061:C 13 Mar 2025 03:32:22.335 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
03:32:22 redis_cache.1 | 28061:C 13 Mar 2025 03:32:22.335 # Redis version=7.0.15, bits=64, commit=00000000, modified=0, pid=28061, just started
03:32:22 system        | schedule.1 started (pid=28075)
03:32:22 redis_queue.1 | 28064:C 13 Mar 2025 03:32:22.336 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
03:32:22 system        | worker.1 started (pid=28073)
03:32:22 redis_queue.1 | 28064:C 13 Mar 2025 03:32:22.337 # Redis version=7.0.15, bits=64, commit=00000000, modified=0, pid=28064, just started
03:32:22 redis_queue.1 | 28064:C 13 Mar 2025 03:32:22.337 # Configuration loaded
03:32:22 redis_queue.1 | 28064:M 13 Mar 2025 03:32:22.337 * Increased maximum number of open files to 10032 (it was originally set to 1024).
03:32:22 redis_queue.1 | 28064:M 13 Mar 2025 03:32:22.337 * monotonic clock: POSIX clock_gettime
03:32:22 redis_queue.1 | 28064:M 13 Mar 2025 03:32:22.338 # Warning: Could not create server TCP listening socket 127.0.0.1:11000: bind: Address already in use
03:32:22 redis_queue.1 | 28064:M 13 Mar 2025 03:32:22.338 # Failed listening on port 11000 (TCP), aborting.
03:32:22 redis_cache.1 | 28061:C 13 Mar 2025 03:32:22.339 # Configuration loaded
03:32:22 redis_cache.1 | 28061:M 13 Mar 2025 03:32:22.339 * Increased maximum number of open files to 10032 (it was originally set to 1024).
03:32:22 redis_cache.1 | 28061:M 13 Mar 2025 03:32:22.339 * monotonic clock: POSIX clock_gettime
03:32:22 redis_cache.1 | 28061:M 13 Mar 2025 03:32:22.339 # Warning: Could not create server TCP listening socket 127.0.0.1:13000: bind: Address already in use
03:32:22 redis_cache.1 | 28061:M 13 Mar 2025 03:32:22.340 # Failed listening on port 13000 (TCP), aborting.
03:32:22 system        | redis_cache.1 stopped (rc=1)
03:32:22 system        | sending SIGTERM to redis_queue.1 (pid 28057)
03:32:22 system        | sending SIGTERM to web.1 (pid 28058)
03:32:22 system        | sending SIGTERM to socketio.1 (pid 28060)
03:32:22 system        | sending SIGTERM to watch.1 (pid 28063)
03:32:22 system        | sending SIGTERM to schedule.1 (pid 28075)
03:32:22 system        | sending SIGTERM to worker.1 (pid 28073)
03:32:22 system        | worker.1 stopped (rc=-15)
03:32:22 system        | web.1 stopped (rc=-15)
03:32:22 system        | socketio.1 stopped (rc=-15)
03:32:22 system        | schedule.1 stopped (rc=-15)
03:32:22 system        | watch.1 stopped (rc=-15)
03:32:22 system        | redis_queue.1 stopped (rc=-15)

I tried killing the processes on the port but it still refreshes with new processes?
Thank you in advance.

when this happened, i simply reboot the system again and start it again. Sorry its not the solution but its works. Is there any other solution like bench stop or something like supervisorctl stop and restart the nginx.service then start the supervisorctl again.

I usually grep for all frappe and redis processes and kill them.
On mac there are the commands that I use.

ps aux | grep -E "frappe|redis"
ps aux | grep -E "frappe|redis" | grep -v grep | awk "{print \$2}" | xargs -r kill

Maybe you are running frappe using supervisor … try

sudo systemctl supervisor stop

Then check for frappe processes.
If there are any, kill them …
then start supervisor again

sudo systemctl supervisor start