[IMP] athene: ignores, ability to restart other odoo processes

This commit is contained in:
Jared Kipe
2022-01-09 14:22:20 -08:00
parent 3ff43099a1
commit 4781654059
3 changed files with 40 additions and 1 deletions

View File

@@ -43,6 +43,14 @@
"program": "/opt/odoo/hibou-suite/odoo-reload.py",
"args": [],
"console": "integratedTerminal"
},
{
"name": "Odoo: reload foreground server, Kill Others",
"type": "python",
"request": "launch",
"program": "/opt/odoo/hibou-suite/odoo-reload.py",
"args": ["KILL_OTHER"],
"console": "integratedTerminal"
}
]
}

17
.theia/settings.json Normal file
View File

@@ -0,0 +1,17 @@
{
"workbench.colorTheme": "Hibou Dark",
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/*.pyc": {"when": "$(basename).py"},
"**/__pycache__": true
},
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/**": true
}
}

View File

@@ -1,17 +1,31 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
import psutil
import os
import signal
import sys
PID = 1
PNAME = 'odoo'
PNAME_PYTHON = ['python']
PNAME_KILL_OTHER = [PNAME] + PNAME_PYTHON
KILL_OTHER = sys.argv[1] == 'KILL_OTHER' if len(sys.argv) >= 2 else False
if KILL_OTHER:
print('Will find other Odoo Processes and Kill them.')
is_foreground = False
for proc in psutil.process_iter():
try:
process_name = proc.name()
process_id = proc.pid
print('Inspecting %s:%s' % (process_id, process_name))
if process_id == PID:
is_foreground = process_name == PNAME
if not KILL_OTHER:
break
if process_id != PID and KILL_OTHER and process_name in PNAME_KILL_OTHER:
print('Killing %s:%s' % (process_id, process_name))
os.kill(process_id, signal.SIGKILL)
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
pass