mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Athene odoo-reload foreground.
This commit is contained in:
@@ -27,6 +27,22 @@
|
|||||||
"-u", "sale",
|
"-u", "sale",
|
||||||
"--test-enable", "--no-xmlrpc", "--stop-after-init"],
|
"--test-enable", "--no-xmlrpc", "--stop-after-init"],
|
||||||
"console": "integratedTerminal"
|
"console": "integratedTerminal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Odoo: server",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "/opt/odoo/hibou-suite/odoo-run.py",
|
||||||
|
"args": [],
|
||||||
|
"console": "integratedTerminal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Odoo: reload foreground server",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "/opt/odoo/hibou-suite/odoo-reload.py",
|
||||||
|
"args": [],
|
||||||
|
"console": "integratedTerminal"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
24
odoo-reload.py
Executable file
24
odoo-reload.py
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
import psutil
|
||||||
|
import os
|
||||||
|
import signal
|
||||||
|
|
||||||
|
PID = 1
|
||||||
|
PNAME = 'odoo'
|
||||||
|
is_foreground = False
|
||||||
|
for proc in psutil.process_iter():
|
||||||
|
try:
|
||||||
|
process_name = proc.name()
|
||||||
|
process_id = proc.pid
|
||||||
|
if process_id == PID:
|
||||||
|
is_foreground = process_name == PNAME
|
||||||
|
break
|
||||||
|
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
|
||||||
|
pass
|
||||||
|
|
||||||
|
if not is_foreground:
|
||||||
|
print('Odoo is not the foreground process.')
|
||||||
|
exit(-1)
|
||||||
|
|
||||||
|
print('Signalling reload to Odoo')
|
||||||
|
os.kill(PID, signal.SIGHUP)
|
||||||
|
|
||||||
Reference in New Issue
Block a user