Repository: phoenix Updated Branches: refs/heads/4.4-HBase-1.0 cf6392699 -> d5b01db97
PHOENIX-1934 queryserver support for Windows service descriptor Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/d5b01db9 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d5b01db9 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d5b01db9 Branch: refs/heads/4.4-HBase-1.0 Commit: d5b01db97cc20a1fb367d13ff44186ee51a24dc9 Parents: cf63926 Author: Nick Dimiduk <ndimi...@apache.org> Authored: Wed Apr 29 06:33:16 2015 -0700 Committer: Nick Dimiduk <ndimi...@apache.org> Committed: Wed Apr 29 06:34:18 2015 -0700 ---------------------------------------------------------------------- bin/queryserver.py | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/d5b01db9/bin/queryserver.py ---------------------------------------------------------------------- diff --git a/bin/queryserver.py b/bin/queryserver.py index 4042f3c..6a18741 100755 --- a/bin/queryserver.py +++ b/bin/queryserver.py @@ -20,9 +20,9 @@ ############################################################################ # -# Script to handle daemonizing the query server process. +# Script to handle launching the query server process. # -# usage: queryserver.py [start|stop] [-Dhadoop=configs] +# usage: queryserver.py [start|stop|makeWinServiceDesc] [-Dhadoop=configs] # import datetime @@ -34,7 +34,13 @@ import subprocess import sys import tempfile -import daemon +try: + import daemon + daemon_supported = True +except ImportError: + # daemon script not supported on some platforms (windows?) + daemon_supported = False + import phoenix_utils phoenix_utils.setPath() @@ -47,6 +53,8 @@ if len(args) > 1: command = 'start' elif args[1] == 'stop': command = 'stop' + elif args[1] == 'makeWinServiceDesc': + command = 'makeWinServiceDesc' if command: args = args[2:] @@ -108,7 +116,24 @@ java_cmd = '%(java)s -cp ' + hbase_config_path + os.pathsep + phoenix_utils.phoe " " + opts + \ " org.apache.phoenix.queryserver.server.Main " + args +if command == 'makeWinServiceDesc': + cmd = java_cmd % {'java': java, 'root_logger': 'INFO,DRFA,console', 'log_dir': phoenix_log_dir, 'log_file': phoenix_log_file} + slices = cmd.split(' ') + + print "<service>" + print " <id>queryserver</id>" + print " <name>Phoenix Query Server</name>" + print " <description>This service runs the Phoenix Query Server.</description>" + print " <executable>%s</executable>" % slices[0] + print " <arguments>%s</arguments>" % ' '.join(slices[1:]) + print "</service>" + sys.exit() + if command == 'start': + if not daemon_supported: + print >> sys.stderr, "daemon mode not supported on this platform" + sys.exit(-1) + # run in the background d = os.path.dirname(out_file_path) if not os.path.exists(d): @@ -137,6 +162,10 @@ if command == 'start': sys.exit(child.wait()) elif command == 'stop': + if not daemon_supported: + print >> sys.stderr, "daemon mode not supported on this platform" + sys.exit(-1) + if not os.path.exists(pid_file_path): print >> sys.stderr, "no Query Server to stop because PID file not found, %s" % pid_file_path sys.exit(0)