Skip to content

Commit

Permalink
make OOM handler be able to handle multiple instances of opentsdb server
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Larsen <[email protected]>
  • Loading branch information
Dieken authored and manolama committed Nov 9, 2015
1 parent 3866e8c commit 56d2cd5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tools/opentsdb_restart.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
import os
import subprocess

service_name = "opentsdb"
if 'NAME' in os.environ:
service_name = os.environ['NAME']

subprocess.call(["service", "opentsdb", "stop"])
subprocess.call(["service", service_name, "stop"])
# Close any file handles we inherited from our parent JVM. We need
# to do this before restarting so that the socket isn't held open.
openfiles = [int(f) for f in os.listdir("/proc/self/fd")]
# Don't need to close stdout/stderr/stdin, leave them open so
# that there is less chance of errors with those standard streams.
# Other files start at fd 3.
os.closerange(3, max(openfiles))
subprocess.call(["service", "opentsdb", "start"])
subprocess.call(["service", service_name, "start"])

0 comments on commit 56d2cd5

Please sign in to comment.