Shutdown erpnext

Just a quick question here, how’d you safely shutdown erpnext? if we want to start we use bench start but how about shutdown erpnext?

No problem just find how to shutdown erpnext properly

There are plenty of commands, for bench config. Kindly refer here:
https://frappe.io/docs/user/en/bench/resources/bench-commands-cheatsheet

If you already know about these commands, please share use case to shutdown erp instance. However, If I’m suffering from any issue similar to you, I just shut down instance itself. Might be my fellows are using some good tactics.

1 Like

I just use CTRL + C and everything just stop. And I think that’s safely shutdown cause the server literally stop. Trying bench stop but the command is not exist and CTRL + c works like a charm

Always used ‘supervisorctl restart’ to restart the processes. I believe it also has ‘stop’ command, but never tested/needed.

@ezraluandre CTRL + C key is used to stop executing the process running on the terminal. It will not help you to shut down the instance.

Ohh crap!!! Is it okay to use ctrl + c for exit it? Or should i use supervisorctl stop like @spoojary says?

supervisorctl is only for production setup. On development setup, I always use ctrl+c

Overall I just use erpnext on production, so next time shutdown the site I should remember using supervisorctl, Got it!!! Thanks @spoojary

Hi Team,
Is there any alternative solution for stop all background terminal?

kill process using kill command if you are using linux.

you have to release port like 11000, 12000, 130000 and 8000 (it may vary in your case like it could be 110001, 120001, 130001 and 8001 )

use cmd: ps -aux | grep 8000
and kill the process using pid

after this you can start bench

If you installed with --production option and you want to stop production services, and start in develop mode:

 sudo service supervisor stop
 sudo service redis stop
 sudo service nginx stop

At this point, you have stopped all production mode services. To start in develop mode, you need to have Procfile in the frappe-bench directory. If you have not yet generated Procfile, you can do this with

 bench setup procfile

(You do the above command to generate the Procfile in the frappe-bench directory which is used by the werkzeug develop server. If you have Procfile, you don’t need to do the above command.)

To start develop server:

 bench start

You access the frappe site with the :8000 port. (Example http://site1.local:8000)

Ctrl-C will terminate the develop server and get you back to the command prompt of the terminal.

To restart the production mode:

    sudo service supervisor start
    sudo service redis start
    sudo service nginx start

If you shutdown the server and start it again, these services are automatically started if you are in production mode.

Develop mode uses werkzeug wsgi server, and lets you see the outputs on the terminal as it receives requests. The server stops when you do ctrl-c. You can activate a python debugger in Visual Code.

Production mode uses gunicorn which can have multiple workers and threads. The supervisor, nginx, and redis services run in the background. Nginx receives the requests and passes it to gunicorn which in turn passes in to frappe. (You may also use bench restart command to restart the server in production mode. But I find the doing the three sudo services commands more reliable.)

Notes:

  bench start    -- for starting the develop mode server (werkzeug)
  bench restart    -- for starting the production mode services (nginx, superviser, nginx + gunicorn).

To check on the status of services - mainly whether they are active or not:

   sudo service supervisor status
   sudo service redis status
   sudo service nginx status
1 Like

@ezraluandre

If you are running the erpnext on local your machine.
You can use " Ctrl + C "

If you are running the erpnext on the server use below command.
sudo service supervisor stop
sudo service nginx stop