diff options
author | asteroide <thomas.duval@orange.com> | 2017-05-18 15:32:57 +0200 |
---|---|---|
committer | asteroide <thomas.duval@orange.com> | 2017-05-18 15:32:57 +0200 |
commit | dfb3cafc5a3fa737ec93d820af7fca6886636fb7 (patch) | |
tree | 6eb81ea7121004a49a0cb8093265df0406b79685 | |
parent | 1fa5b9920f0414708a61afa48498792d72a26cbd (diff) |
Write a PID file
Change-Id: I28f014a90c891db07d359d111b17817b65fa84b5
-rw-r--r-- | moonv4/moon_orchestrator/moon_orchestrator/server.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/moonv4/moon_orchestrator/moon_orchestrator/server.py b/moonv4/moon_orchestrator/moon_orchestrator/server.py index e6d28c23..959375be 100644 --- a/moonv4/moon_orchestrator/moon_orchestrator/server.py +++ b/moonv4/moon_orchestrator/moon_orchestrator/server.py @@ -104,8 +104,16 @@ def _exit(exit_number=0, docker=None, error=None): sys.exit(exit_number) +def __save_pid(): + try: + open("/var/run/moon_orchestrator.pid", "w").write(str(os.getpid())) + except PermissionError: + LOG.warning("You don't have the right to write PID file in /var/run... Continuing anyway.") + + def main(): # conf_file = options.configure(DOMAIN) + __save_pid() LOG.info("Starting server with IP {}".format(CONF.orchestrator.host)) docker_manager = DockerManager() |