Note the following works for development (yes, supervisor is normally production ERPNext)
sudo supervisorctl
stop all
sudo service nginx stop
bench start
The following is attributed to Adam Dawoodjee https://discuss.erpnext.com/u/adam26d
Also, you may try from GIT: https://github.com/proenterprise/bench-stop
This is a simple modification to submission for those with ERPNext directory structure modified for home/frappe/frappe-bench. Note this is for development mode and not production. After sto
pping bench via:
ctrl+c or (will be an issue from SSH) so
Hard stop $: sudo killall -9 python
After this, if redis is still running, you MUST manually shut down ports (see steps 1-3 first). The code saves you from listening to netstat and checking all of the ports manually. If you changed ports manually prior, simply change the port list in the ports = line of code below.
To upload to GCP VM simply selected the up button and upload the file as stop.py
(Copy the code below into notepad (or other) and save file as stop.py )
Next, su root to change to root. The upload in Ubuntu will go to your user directly. Simply run $: python3 stop.py
and wallah! Now change to su frappe (or your user name), switch to bench directory cd/home/frappe/frappe-bench (frappe bench directory) and you may now run bench start
""" stop.py is an attempt at creating an easy 'bench stop' command
Expected improvements:
- refactor
- merge with bench
- check for production where stop command will use existing supervisor
- check for non-ubuntu platforms
"""
import os, socket, errno
# Getting port suffix from current redis config.
ports = [1100, 1200, 1300, 900, 800]
lines = {}
port_suffix = 0;
sockets = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
with open("/home/frappe/frappe-bench/config/redis_cache.conf") as config_file:
for line in config_file:
key, value = line.partition(" ")[::2]
lines[key.strip()] = value.strip()
port_suffix = lines["port"][-1:]
config_file.close()
for port in ports:
port = int("".join([str(port), str(port_suffix)]))
try:
sockets.bind(("127.0.0.1", port))
except socket.error as e:
if e.errno == errno.EADDRINUSE:
os.system("echo 'shutdown' | redis-cli -h 127.0.0.1 -p %d" % port)
print('Port %d' % port, 'closed')
Comentários