How to stop bench

hello all,

i have started the bench using “bench start” , however to stop the bench i should press “ctrl + c”. but instead of pressing “ctrl + c”. i closed the ssh session, now the website is always running. how can i stop the bench ??


I asked myself the same question before. As far as I know there is only bench start and bench restart, so just pure logic there is a bench stop command that’s missing (or probably there must be another method for stopping it).

I have used
sudo service supervisor stop

Works for me since supervisor is only running frappe-bench

EDIT: Sorry I didn’t see where you stated you manually started bench. Can you SSH back in and reboot, or stop the nginx service? You could also use htop to stop individual processes.

@sdqadeer44 on command line:

$ps aux | grep bench

look for the PID of the process and then use:

$kill -9 PID

if doesn’t work try with “lsof -i:8000” or 8080 it depends of the port that you configured, this to see the PID of the process.


really? killing it is the only way? shouldn’t there be something to gracefully (I think that’s the term) stops the bench?

1 Like

try with:

kill -SIGTERM PID but may be it will leave a zombie. If you looking for something like bench stop you are lose your time because bench in developer mode “runs” in the current ssh session and if lose the connexion the process hangs better know as zombie process.

1 Like

@gvargas I am not talking about a particular scenario (accessing my server through ssh, or so) more generally interested in how to stop the bench gracefully. I guess it’s not the most like thing that the developers of bench just forgot to have a command for stopping it?

And as we are at it I think it would be great to have the ability to see that status of it (runing, stopped, which sites are running on which ports, …)

something like bench status (which apparently doesn’t exist)

bench start method for starting bench is for setting up development environment. Kill it with CTRL+C.

For production deployment use nginx, supervisor

In production deployment where nginx and supervisor are up on boot. Use command bench doctor to check status of production deployed bench.

Configured ports:

For production setup where port based multi-tenent is configured, run command bench setup nginx
to generate frappe-bench/config/nginx.conf with configured ports.

Port for site is set in site_config.json of the site by running command bench set-nginx-port sitename 80

site_config.json after port is set to 80:

 "db_password": "dbpassword", 
 "db_name": "dbname", 
 "nginx_port": 80
1 Like

@vrms totally agree!

just for my understanding.

This actually has the exact same implications (ERPnext being served under port 80) as if there was not entry about the nginx port in the site_config.json file at all (because port 80 is the standard port), right?

My developmnet environment went background . how can I restart bench one shot? I’t s not comfrtable to kill one bye one all processes all the time a restart is required in the development environment

any advice?

It went in background? Did the process go in background after pressing Ctrl + Z?

Following command can be used to bring it in foreground if it went in background due to Ctrl + z


Hmmm… don’t know if its the right way but this certainly works for develop mode.
Try : sudo pkill node



I’ve found these commands work:

ps aux | grep bench

killall -s 9 python

Then to make sure everyting OK:

bench start

I hope this help :slight_smile:


Apologies for necroing a 3-year old post. However, it’s still quite relevant. For those catching up, the original question was “We can start bench, and restart bench…how can we stop it?

First, a short demonstration of why “CTRL + C” won’t always work. In your bash shell, simply do this:

bench start $

Now, bench is running in the background.

  • Yes, I know you can return this to the foreground, using fg.
  • Yes, I know you can hunt for processes using ps aux | grep bench, and a dozen different variations.
  • Yes, I know this issue doesn’t happen in Production.

With all that said…it’s still a pain.

Folks, we have at least 50 different bench commands. How about we add just 1 more, to automatically kill Bench/Frappe/ERPNext. No matter whether it’s running in the foreground, background, underground, or coffee ground.

I’ll give you a few days to convince me that I’m asking for crazy things. Otherwise, I’ll open an Issue in GitHub against Bench.


Hi, I feel the pain now, I wonder if your issue in Github has been opened yet?
Would like to know any follow up solutions.

Thank you.

No, there are no official solutions in the repository.

However, Adam Dawoodjee @adam26d kindly provided a python script to accomplish this.


Hi Brian, thank you for the reply and link to the python script repository.

That python script is working as expected. Thank you, @adam26d.

1 Like

A great thing, Brian. Thank you!

@brian_pond - great initiative and @adam26d -the work you did is enabling users like me without any coding knowledge to reach for our dreams. Please keep up the great work

1 Like