代码拉取完成,页面将自动刷新
同步操作将从 则霖信息技术(深圳)有限公司/ERPNext界面汉化 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/usr/bin/env python
""" stop.py is an attempt at creating an easy 'bench stop' command
Expected improvements:
- import port suffix from config/redis_cache.conf - done
- check for exceptions - done
- use SIGTERM - done
- Refactor code and merge with bench
- check for production where stop command will use supervisor
- check for non-ubuntu platforms
"""
import os, socket, errno, time
# Declaring part of ports.
# 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)
try:
with open("./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()
except IOError:
print('The file redis_cache.conf was not found. Are you sure you stop.py is in bench directory?')
exit();
# Closing open ports after combining each port prefix and suffix
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)
time.sleep(3)
try:
sockets.bind(("127.0.0.1", port))
except socket.error as e:
if e.errno == errno.EADDRINUSE:
os.system("fuser %d/tcp -k" % port)
else:
print ('Port %d' % port, 'now closed')
else:
print ('Port %d' % port, 'already closed')
sockets.close()
sockets = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
continue
sockets.close()
print ('bench stopped')
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。