You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by rl...@apache.org on 2015/10/12 11:19:51 UTC

[2/4] incubator-hawq git commit: HAWQ-39. Remove below unused mgmt scritps for hawq2.0:

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8ec87e6a/tools/bin/gpseginstall
----------------------------------------------------------------------
diff --git a/tools/bin/gpseginstall b/tools/bin/gpseginstall
deleted file mode 100755
index a1f5bd4..0000000
--- a/tools/bin/gpseginstall
+++ /dev/null
@@ -1,973 +0,0 @@
-#!/usr/bin/env python
-'''
-USAGE:   gpseginstall -f|--file HOSTFILE [-u|--user USER] [-g|--group GROUP] [-p|--password PASSWORD] [-c|--commands COMMAND_OPTIONS] [--verbose]
-         where HOSTFILE lists all the hosts to install the software on
-         where USER will be the user to install the software as. The default is gpadmin. (root only option)
-         where GROUP will be the group to install the software as. The default is gpadmin.
-         where PASSWORD will be set for the USER default is changeme (root only option)
-
-         where COMMAND_OPTIONS list a subset of commands to be run from the list below.  The default is all commands.
-            u -- add user  (root only)
-            c -- chown software on master host (root only)
-            s -- tar, zip and copy over software to machines in cluster
-            p -- change passwords (root only)
-            E -- exchange keys for root (root only)
-            e -- exchange keys for user
-            l -- check and fix user limits for new user -- requires software to be installed on cluster with command 's' or equivalent (root only)
-            v -- verify software on remote machines
-'''
-
-import os, sys, re
-import subprocess, warnings, logging, tarfile
-warnings.simplefilter('ignore', DeprecationWarning)
-sys.path.append(sys.path[0] + '/lib')
-
-try:
-    import paramiko, getpass, pexpect
-    import gppylib.userinput
-    from optparse import Option, OptionParser 
-    from gppylib.gpparseopts import OptParser, OptChecker
-    from gppylib.gplog import get_default_logger, setup_tool_logging
-    from gppylib.commands.unix import getLocalHostname, getUserName, SYSTEM
-    from gppylib.commands.base import WorkerPool, Command, NakedExecutionPasswordMap, NakedExecutionInfo, NAKED
-except ImportError, e:    
-    sys.exit('Cannot import modules.  Please check that you have sourced greenplum_path.sh.  Detail: ' + str(e))
-
-EXECNAME = os.path.split(__file__)[-1]
-
-logger = get_default_logger()
-setup_tool_logging(EXECNAME,getLocalHostname(),getUserName()) 
-hosts = dict() # address to HostMapping object
-uniqueseghosts = dict() # hostname to UniqueHost object
-options = None
-passwordMap = None
-nullFile = logging.FileHandler('/dev/null')
-logging.getLogger('paramiko.transport').addHandler(nullFile)
-pool = None
-gphome = None
-installation_info = None
-commands = set() # selected commands
-rootCommands = set(['u', 'p', 'c', 's', 'e', 'E', 'l', 'v']) # valid command types for root
-nonRootCommands = set(['s', 'e', 'v'])                       # valid command types for non-root user
-defaultNonRootCommands = set(['s', 'v'])                     # commands to run by default for non-root user
-currentUser = None
-isLinux = False
-GPSSH_EXKEYS_TIMEOUT = 600
-
-class InstallationInfo:
-    def __init__(self, link_name, binary_path, binary_dir_location, binary_dir_name):
-        self.install_link_name = link_name                      # greenplum-db  
-        self.install_binary_path = binary_path                  # /data/release-4.0
-        self.install_binary_dir_location = binary_dir_location  # /data
-        self.install_binary_dir_name = binary_dir_name          # release-4.0
-        self.install_md5 = None
-        self.install_version_string = None
-
-    def debugStr(self):
-        return "link_name %s\nbinary_path %s\nbinary_dir_location %s\nbinary_dir_name %s" % (self.install_link_name, self.install_binary_path, self.install_binary_dir_location, self.install_binary_dir_name)
-
-class HostMapping:
-    def __init__(self, address):
-        self.address = address
-        self.hostname = None
-
-    def debugStr(self):
-        return "address %s hostname %s" % (self.address, self.hostname)
-
-class UniqueHost:
-    def __init__(self, address, hostname):
-        self.address = address
-        self.hostname = hostname
-        self.userExists = False
-    
-    def debugStr(self):
-        return "address %s hostname %s userExists %s" % (self.address, self.hostname, self.userExists)
-
-def cli_help():
-    help_path = os.path.join(sys.path[0], '..', 'docs', 'cli_help', EXECNAME + '_help')
-    f = None
-    try:
-        try:
-            f = open(help_path);
-            return f.read(-1)
-        except:
-            return ''
-    finally:
-        if f: f.close()
-
-
-def usage():
-    print cli_help() or __doc__
-
-# True is an error
-def parseargs():
-
-    global options, isLinux
-
-    parser = OptParser(option_class=OptChecker)
-    parser.remove_option('-h')
-    parser.add_option('-h', '-?', '--help', action='store_true')
-    parser.add_option('-f', '--file', type='string')
-    parser.add_option('-u', '--user', type='string', default='gpadmin')
-    parser.add_option('-g', '--group', type='string')
-    parser.add_option('-p', '--password', type='string')
-    parser.add_option('-c', '--commands', type='string')
-    parser.add_option('--verbose', action='store_true')
-    (options, args) = parser.parse_args()
-
-    global gphome
-    gphome = os.environ.get('GPHOME')
-    if not gphome:
-        logger.error("GPHOME not set")
-        return True
-
-    if SYSTEM.getName() != "linux" and SYSTEM.getName() != "sunos":
-        logger.error("This utility is only supported on the linux and solaris operating system")
-        return True
-
-    if SYSTEM.getName() == "linux":
-        isLinux = True
-
-    if options.help:
-        usage()
-        return True
-
-    if not options.file:
-        logger.error("--file must be specified")
-        return True
-
-    if not os.path.exists(options.file):
-        logger.error("file %s does not exist" % options.file)
-        return True
-
-    if options.user == "root":
-        logger.error("can not install the software into the account of user root")
-        return True
-
-    global currentUser
-    currentUser = getpass.getuser()
-
-    if currentUser == "root":
-        validCommands = rootCommands
-    else:
-        validCommands = nonRootCommands
-
-        if options.user != currentUser:
-            logger.error("--user option '%s' does not equal non-root user running this utility '%s'" % (options.user, currentUser))
-            return True
-
-    if not options.group:
-        options.group = options.user
-
-    global commands
-    if options.commands and len(options.commands):
-        for i in range(len(options.commands)):
-            if options.commands[i] in validCommands:
-                if options.commands[i] not in commands:
-                    commands.add(options.commands[i])
-            else:
-                logger.error("'%s' is not a valid command for user(%s)" % (options.commands[i], currentUser))
-                return True
-    else:
-        if currentUser == "root":
-            commands = rootCommands
-        else:
-            commands = defaultNonRootCommands
-
-    location = os.path.abspath(gphome)
-    if os.path.islink(location):
-        link_name = os.path.split(location)[1]
-        binary_path = os.path.realpath(location)
-    else:
-        link_name = None
-        binary_path = location
-
-    (binary_dir_location, binary_dir_name) = os.path.split(binary_path)
- 
-    global installation_info
-    installation_info = InstallationInfo(link_name, binary_path, binary_dir_location, binary_dir_name)
-    logger.info("Installation Info:\n" + installation_info.debugStr())
- 
-    return False
-
-# True is an error
-def readHostList():
-
-    try:
-        for line in open(options.file, "r"):
-            hostname = line.strip()
-            if not len(hostname):
-                continue
-            hosts[hostname] = HostMapping(hostname)
-    except Exception, e:
-        logger.error("Error while reading file: %s" % options.file)
-        logger.error(e.__str__())
-        return True
-
-    if not len(hosts.keys()):
-        logger.error("No hosts read from hostfile: %s" % options.file)
-        return True
-
-    return False
-
-# True is an error
-def discoverPasswordMap():
-
-    logger.info("check cluster password access")
-
-    global passwordMap
-
-    try:    
-        passwordMap = NakedExecutionPasswordMap(hosts.keys())
-        passwordMap.discover()
-    except Exception, e:
-        logger.error("could not successfully access all machines")
-        msg = e.__str__()
-        if msg:
-            logger.error("trace: %s" % msg)
-        return True
-
-    if passwordMap.complete:
-        return False
-    else:
-        return True
-
-# True is an error
-def dedupeHosts():
-
-    logger.info("de-duplicate hostnames")
-
-    masterHostName = None
-
-    try:
-        cmd = Command("master", "hostname")
-        pool.addCommand(cmd)
-        pool.join()
-        items = pool.getCompletedItems()
-        for i in items:
-            if i.results.rc or i.results.halt or not i.results.completed:
-                logger.error("error trying to obtain hostname on master %s" % i.results.stderr)
-                return True
-            masterHostName = i.results.stdout.strip()
-            break
-    except Exception, e:
-        logger.error("exception trying to obtain hostname on master: %s" % e.__str__())
-        return True
-
-    if not masterHostName:
-        logger.error("Could not find master hostname")
-        return True
-
-    logger.info("master hostname: %s" % masterHostName)
-
-    try:
-        for host in hosts.keys():
-            cmd = Command(host, "hostname", NAKED, host, nakedExecutionInfo=NakedExecutionInfo(passwordMap))
-            pool.addCommand(cmd)
-
-        pool.join()
-        items = pool.getCompletedItems()
-        for i in items:
-            address = i.remoteHost
-            if i.results.rc or i.results.halt or not i.results.completed:
-                logger.error("error obtaining information from host %s" % address)
-                return True
-            hostname = i.results.stdout[0].strip()
-            hosts[address].hostname = hostname
-    except Exception, e:
-        logger.error("%s" % e.__str__())
-        return True
-
-    global uniqueseghosts
-    for k in hosts.keys():
-        hostname = hosts[k].hostname
-        address = hosts[k].address
-
-        if hostname in uniqueseghosts:
-            # Here we do a heuristic:
-            # there are several interfaces to each host
-            # and we don't want to pick a slow interface
-            # it is very likely that a hostname with a '-' will represent a fast link
-            # so try to pick an address that contains a '-'
-            # for example choose sdw1-1 over vert1
-            if (not re.search("-", uniqueseghosts[hostname].address)) and (re.search("-", address)):
-                uniqueseghosts[hostname].address = address
-            continue
-
-        if masterHostName == hostname:
-            continue
-
-        uniqueseghosts[hostname] = UniqueHost(address, hostname)
-
-    if options.verbose:
-        for k in uniqueseghosts.keys():
-            logger.info("segment hostname: %s (%s)" % (uniqueseghosts[k].address, k))
-
-    return False
-
-# True is an error
-def checkUsernames():
-
-    logger.info("check for user %s on cluster" % options.user)
-
-    try:
-        for k in uniqueseghosts.keys():
-            uh = uniqueseghosts[k]
-            cmd = Command(uh.address, "id %s" % options.user, NAKED, uh.address, nakedExecutionInfo=NakedExecutionInfo(passwordMap))
-            pool.addCommand(cmd)
-        pool.join()
-        items = pool.getCompletedItems()
-        for i in items:
-            if not i.results.rc:
-                address = i.remoteHost
-                hostname = hosts[address].hostname
-                uniqueseghosts[hostname].userExists = True
-    except Exception, e:
-        logger.error("%s" % e.__str__())
-        return True
-
-    return False
-
-def getAddUserCommand():
-    if isLinux:
-        return "useradd -m %s" % options.user
-    else:
-        return "groupadd %s; useradd -d /export/home/%s -m -g %s -s /bin/bash %s" % (options.user, options.user, options.user, options.user)
-
-# True is an error
-def addUserIfRequired():
-
-    ###################################################################################
-    logger.info("add user %s on master" % options.user)
-    try:
-        cmd = Command("useradd", getAddUserCommand())
-        pool.addCommand(cmd)
-        pool.join()
-        items = pool.getCompletedItems() # get the completed items but ignore them
-    except Exception, e:
-        logger.error("%s" % e.__str__())
-        return True
-
-    try:
-        cmd = Command("checkId", "id %s" % options.user)
-        pool.addCommand(cmd)
-        pool.join()
-        items = pool.getCompletedItems()
-        for i in items:
-            if i.results.rc:
-                logger.error("failed to add user %s to master host: %s" % (options.user, i.results.stderr))
-                return True
-    except Exception, e:
-        logger.error("%s" % e.__str__())
-        return True
-     
-    ###################################################################################
-    logger.info("add user %s on cluster" % options.user)
-
-    failedToAddUser = set() # set of address's where useradd failed
-    try:
-        for k in uniqueseghosts.keys():
-            uh = uniqueseghosts[k]
-            if uh.userExists:
-                continue
-
-            cmd = Command(uh.address, getAddUserCommand(), NAKED, uh.address, nakedExecutionInfo=NakedExecutionInfo(passwordMap))
-            pool.addCommand(cmd)
-        pool.join()
-        items = pool.getCompletedItems()
-        for i in items:
-            address = i.remoteHost
-            if not i.results.rc:
-                hostname = hosts[address].hostname
-                uniqueseghosts[hostname].userExists = True
-            else:
-                logger.error("%s: %s" % (address, i.results.stderr))
-                failedToAddUser.add(address)
-                
-    except Exception, e:
-        logger.error("%s" % e.__str__())
-        return True
-
-    if len(failedToAddUser):
-        for h in failedToAddUser:
-            logger.error("could not create user %s on host %s" % (options.user, h))
-        return True
-
-    return False
-
-# True is an error
-def  getLocalSoftwareVersion():
-
-    global installation_info
-    cmdStr = "%s/bin/gpssh --version" % gphome
-    try:
-        cmd = Command("version", cmdStr)
-        pool.addCommand(cmd)
-        pool.join()
-        items = pool.getCompletedItems()
-        for i in items:
-            if i.results.rc:
-                logger.error("Failed to run command: %s" % cmd.cmdStr)
-                logger.error(i.results.stderr)
-                return True
-
-            installation_info.install_version_string = i.results.stdout.strip()
-    except Exception, e:
-        logger.error("%s" % e.__str__())
-        return True
-
-    return False
-
-# True is an error
-def  simpleLocalCommand(cmdStr, checkError=True, verbose=True):
-    if verbose:
-        logger.info(cmdStr)
-    try:
-        cmd = Command("simpleLocalCommand", cmdStr)
-        pool.addCommand(cmd)
-        pool.join()
-        items = pool.getCompletedItems()
-        if checkError:
-            for i in items:
-                if i.results.rc:
-                    logger.error("Failed to run command: %s" % cmd.cmdStr)
-                    logger.error(i.results.stderr)
-                    return True 
-    except Exception, e:
-        logger.error("%s" % e.__str__())
-        return True
-
-    return False
-
-# True is an error
-def  simpleRemoteCommand(cmdStr, checkError=True, verbose=True):
-
-    failures = set()
-    if verbose:
-        logger.info("remote command: %s" % cmdStr)
-
-    try:
-        for k in uniqueseghosts.keys():
-            uh = uniqueseghosts[k]
-            cmd = Command(uh.address, cmdStr, NAKED, uh.address, nakedExecutionInfo=NakedExecutionInfo(passwordMap))
-            pool.addCommand(cmd)
-        pool.join()
-        items = pool.getCompletedItems()
-        if checkError:
-            for i in items:
-                if i.results.rc:
-                    logger.error("%s: %s" % (i.remoteHost, i.results.stderr))
-                    failures.add(i.remoteHost)
-                    
-    except Exception, e:
-        logger.error("%s" % e.__str__())
-        return True
-
-    if len(failures):
-        for h in failures:
-            logger.error("error running command %s on host %s" % (cmdStr, h))
-        return True
-
-    return False
-
-
-# True is an error
-def chownMasterSoftware():
-
-    ###################################################################################
-    if installation_info.install_link_name:
-
-        cmdStr = "chown -R %s:%s %s/%s" % (options.user, options.group, installation_info.install_binary_dir_location, installation_info.install_link_name)
-        if (simpleLocalCommand(cmdStr, True)):
-            return True
-
-    ###################################################################################
-    cmdStr = "chown -R %s:%s %s" % (options.user, options.group, installation_info.install_binary_path)
-    if (simpleLocalCommand(cmdStr, True)):
-        return True
-
-
-# True is an error
-def changeUserPassword():
-
-    if not options.password:
-        password = gppylib.userinput.ask_create_password()
-        if not password:
-            logger.error("error obtaining password from user")
-            return True
-    else:
-        password = options.password
-    cmd = "%s/sbin/gpchangeuserpassword --user %s --password %s" % (gphome, options.user, password)
-
-    logger.info("Changing system passwords ...")
-    if (simpleLocalCommand(cmd, False, verbose=False)):
-        return True
-
-    cmdStr = ". %s/greenplum_path.sh; %s" % (gphome, cmd)
-
-    if (simpleRemoteCommand(cmdStr, True, verbose=False)):
-        return True
-
-def md5Command():
-    if isLinux:
-        return "md5sum"
-    else:
-        return "digest -a md5"
-
-def md5OutputWords():
-    if isLinux:
-        return 2
-    else:
-        return 1
-
-
-# True is an error
-def setMd5Locally():
-
-    try:
-        cmd = Command("md5", "%s %s.tar" % (md5Command(), installation_info.install_binary_path))
-        pool.addCommand(cmd)
-        pool.join()
-        items = pool.getCompletedItems()
-        for i in items:
-            if i.results.rc:
-                logger.error("Failed to run command: %s" % cmd.cmdStr)
-                logger.error(i.results.stderr)
-                return True 
-            else:
-                fields = i.results.stdout.split()
-                if len(fields) != md5OutputWords():
-                    raise Exception("Unexpected output from md5sum: %s" % i.results.stdout)
-                installation_info.install_md5 = fields[0].strip()
-                break
-    except Exception, e:
-        logger.error("%s" % e.__str__())
-        return True
-
-    return False
-
-# True is an error
-def copyOverSoftware():
-
-    ###################################################################################
-    cmdStr = "rm -f %s.tar; rm -f %s.tar.gz" % (installation_info.install_binary_path, installation_info.install_binary_path)
-    if (simpleLocalCommand(cmdStr, False)):
-        return True
-
-    cmdStr = "cd %s; tar cf %s.tar %s" % (installation_info.install_binary_dir_location, installation_info.install_binary_dir_name, installation_info.install_binary_dir_name)
-    if (simpleLocalCommand(cmdStr, False)):
-        return True
-
-    ###################################################################################
-    if setMd5Locally():
-        return True
-
-    ###################################################################################
-
-    cmdStr = "gzip %s.tar" % installation_info.install_binary_path
-    if (simpleLocalCommand(cmdStr, False)):
-        return True
-
-    ###################################################################################
-    cmdStr = "mkdir -p %s" % installation_info.install_binary_dir_location
-    if (simpleRemoteCommand(cmdStr, True)):
-        return True
-
-    ###################################################################################
-    # a couple paranoid checks
-    if installation_info.install_binary_path == "/" or  \
-       installation_info.install_binary_path == "/usr" or \
-       installation_info.install_binary_path == "/usr/bin" or \
-       re.search('boot', installation_info.install_binary_path):
-        raise Exception("illegal path for installaiton %s" % installation_info.install_binary_path)
-       
-    cmdStr = "rm -rf %s" % (installation_info.install_binary_path)
-    if (simpleRemoteCommand(cmdStr, True)):
-        return True
-
-    ###################################################################################
-    logger.info("scp software to remote location")
-
-    failures = set()
-
-    filename = installation_info.install_binary_path + ".tar.gz"
-    try:
-        for k in uniqueseghosts.keys():
-            uh = uniqueseghosts[k]
-            cmdStr = "scp %s %s:%s" % (filename, uh.address, installation_info.install_binary_dir_location)
-            cmd = Command(uh.address, cmdStr)
-            pool.addCommand(cmd)
-        pool.join()
-        items = pool.getCompletedItems()
-        for i in items:
-            if i.results.rc:
-                logger.error("command failed: '%s': %s" % (i.cmdStr, i.results.stderr.strip()))
-                failures.add(i.name)
-                
-    except Exception, e:
-        logger.error("%s" % e.__str__())
-        return True
-
-    if len(failures):
-        return True
-
-
-    ###################################################################################
-    cmdStr = "gzip -f -d %s.tar.gz" % installation_info.install_binary_path
-    if (simpleRemoteCommand(cmdStr, True)):
-        return True
-
-    ###################################################################################
-    logger.info("md5 check on remote location")
-    failures.clear()
-
-    try:
-        for k in uniqueseghosts.keys():
-            uh = uniqueseghosts[k]
-            cmdStr = "%s %s.tar" % (md5Command(), installation_info.install_binary_path)
-            cmd = Command(uh.address, cmdStr, NAKED, uh.address, nakedExecutionInfo=NakedExecutionInfo(passwordMap))
-            pool.addCommand(cmd)
-        pool.join()
-        items = pool.getCompletedItems()
-        for i in items:
-            address = i.remoteHost
-            if i.results.rc:
-                logger.error("%s: %s" % (address, i.results.stderr))
-                failures.add(address)
-            else:
-                fields = i.results.stdout[0].split()
-                if len(fields) == md5OutputWords():
-                    md5 = fields[0].strip()
-                    if md5 != installation_info.install_md5:
-                        logger.error("on host %s md5sum %s != expected %s" % (address, md5, installation_info.install_md5))
-                        failures.add(address)
-                else:
-                    logger.error("Unexpected output on host %s from md5sum: %s" % (address, i.results.stdout))
-                    failures.add(address)
-                
-    except Exception, e:
-        logger.error("%s" % e.__str__())
-        return True
-
-    if len(failures):
-        for h in failures:
-            logger.error("md5sum check of %s.tar on host %s failed" % (installation_info.install_binary_path, h))
-        return True
-
-    ###################################################################################
-    cmdStr = "cd %s; tar xf %s.tar" % (installation_info.install_binary_dir_location, installation_info.install_binary_dir_name)
-    if (simpleRemoteCommand(cmdStr, True)):
-        return True
-
-    ###################################################################################
-    cmdStr = "rm -f %s.tar" % (installation_info.install_binary_path)
-    if (simpleRemoteCommand(cmdStr, True)):
-        return True
-
-    ###################################################################################
-    if installation_info.install_link_name:
-        cmdStr = "cd %s; rm -f %s; ln -fs %s %s" % (installation_info.install_binary_dir_location, installation_info.install_link_name, installation_info.install_binary_dir_name, installation_info.install_link_name)
-        if (simpleRemoteCommand(cmdStr, True)):
-            return True
-
-        if currentUser == "root":
-            cmdStr = "chown -R %s:%s %s/%s" % (options.user, options.group, installation_info.install_binary_dir_location, installation_info.install_link_name)
-            if (simpleRemoteCommand(cmdStr, True)):
-                return True
-
-    ###################################################################################
-    if currentUser == "root":
-        cmdStr = "chown -R %s:%s %s" % (options.user, options.group, installation_info.install_binary_path)
-        if (simpleRemoteCommand(cmdStr, True)):
-            return True
-
-    ###################################################################################
-    cmdStr = "rm -f %s.tar.gz" % (installation_info.install_binary_path)
-    if (simpleLocalCommand(cmdStr, True)):
-        return True
-
-    ###################################################################################
-    return False
-
-
-# True is an error
-def verifyVersionAtPath(usepath):
-
-    cmdStr = ". %s/greenplum_path.sh; %s/bin/gpssh --version" % (usepath, usepath)
-    logger.info("remote command: %s" % cmdStr)
-
-    try:
-        for k in uniqueseghosts.keys():
-            uh = uniqueseghosts[k]
-            cmd = Command(uh.address, cmdStr, NAKED, uh.address, nakedExecutionInfo=NakedExecutionInfo(passwordMap))
-            pool.addCommand(cmd)
-        pool.join()
-        items = pool.getCompletedItems()
-        for i in items:
-            if i.results.rc:
-                logger.error("error on host with command: %s" % (i.remoteHost, cmdStr))
-                return True
-            if not i.results.stdout:
-                logger.error("could not find version string from host %s with command: %s" % (i.remoteHost, cmdStr))
-                return True
-            version_string = i.results.stdout[0].strip()
-            if version_string != installation_info.install_version_string:
-                logger.error("version string on host %s: '%s' does not match expected: '%s'" % (i.remoteHost, version_string, installation_info.install_version_string))
-                return True
-
-    except Exception, e:
-        logger.error("%s" % e.__str__())
-        return True
-
-    return False
-
-
-# True is an error
-def verifySoftware():
-
-    if (getLocalSoftwareVersion()):
-        return True
-
-    logger.info("version string on master: %s" % installation_info.install_version_string)
-
-    if verifyVersionAtPath(gphome):
-        return True
-
-    if gphome != installation_info.install_binary_path:
-        if verifyVersionAtPath(installation_info.install_binary_path):
-            return True
-
-    return False
-
-# True is an error
-def checkAndFixUserLimits():
-
-    if not isLinux:
-        return False
-
-    cmd = "%s/sbin/gpfixuserlimts -f /etc/security/limits.conf -u %s" % (gphome, options.user)
-    if (simpleLocalCommand(cmd, True)):
-        return True
-
-    cmdStr = ". %s/greenplum_path.sh; %s" % (gphome, cmd)
-    if (simpleRemoteCommand(cmdStr, True)):
-        return True
-
-    return False
-
-
-# True is an error
-def interactiveCommand(cmdStr):
-
-    try:
-        p = subprocess.Popen(cmdStr, shell=True, executable="/bin/bash")
-        sts = os.waitpid(p.pid, 0)[1]
-        if sts:
-            logger.error("error on cmd: %s" % cmdStr)
-    except Exception, e:
-        logger.error("Exception running cmd: %s" % cmdStr)
-        logger.error(e.__str__())
-        return True
-        
-    return False
- 
-# True is an error
-def exchangeKeysUser():
-
-    if currentUser == "root":
-        return exchangeKeysAsRootForUser()
-    else:
-        return exchangeKeysAsSelf()
-
-# True is an error
-def exchangeKeysAsSelf():
-
-    cmdStr = 'gpssh-exkeys -f %s' % options.file
-    return interactiveCommand(cmdStr)
-
-# True is an error
-def exchangeKeysAsRootForUser():
-
-    ###################################################################################
-    logger.info("exchange ssh keys for user %s" % options.user)
-
-    testCmd = 'su %s -c "cat %s &> /dev/null"' % (options.user, options.file)
-    try:
-        p = subprocess.Popen(testCmd, shell=True, executable="/bin/bash")
-        sts = os.waitpid(p.pid, 0)[1]
-        if sts:
-            logger.error("failed doing a test read of file: %s" % testCmd)
-            logger.error("%s is not accessible as user %s" % (options.file, options.user))
-            return True
-    except Exception, e:
-        logger.error("failed doing a test read of file: %s" % testCmd)
-        logger.error("%s is not accessible as user %s" % (options.file, options.user))
-        logger.error(e.__str__())
-        return True
- 
-    done = False
-    badPassword = False
-    child = None
-    cmdStr = None
-
-    try:
-        cmdStr = 'su %s -c "gpssh-exkeys -f %s"' % (options.user, options.file)
-        child = pexpect.spawn(cmdStr)
-
-        index = 0
-        while 1:
-            index = child.expect(["password", "bad", pexpect.EOF, pexpect.TIMEOUT], timeout=GPSSH_EXKEYS_TIMEOUT)
-            if index == 0:
-                child.sendline(options.password)
-                continue
-            if index == 1:
-                badPassword = True
-                break
-            if index == 2:
-                done = True
-                break
-            if index == 3:
-                logger.info("Timeout running command: %s" % cmdStr)
-                break
-
-    except Exception, e:
-        logger.info("Exception running cmd: %s" % cmdStr)
-        logger.info(e.__str__())
-
-    if done:
-        child.close()
-        if child.exitstatus:
-            logger.info("Cmd '%s' failed with error code %s" % (cmdStr, child.exitstatus))
-        else:
-            return False
-
-    # using the supplied password did not work... lets try again in interactive mode
-    logger.info("gppsh-exkeys failed running from within pexpect ... now try outside of pexpect")
-    return interactiveCommand(cmdStr)
-   
-# True is an error
-def exchangeKeysRoot():
-    ###################################################################################
-    logger.info("exchange ssh keys for user root")
-
-    rootPasswords = list(passwordMap.unique_passwords)
-
-    done = False
-    child = None
-    cmdStr = None
-    passwordIndex = 0
-    
-
-    try:
-        cmdStr = 'gpssh-exkeys -f %s' % options.file
-        child = pexpect.spawn(cmdStr)
-
-        index = 0
-        while 1:
-            index = child.expect(["password", "bad", pexpect.EOF, pexpect.TIMEOUT], timeout=GPSSH_EXKEYS_TIMEOUT)
-            if index == 0:
-                passwordIndex = 0
-                child.sendline(rootPasswords[passwordIndex])
-                continue
-            if index == 1:
-                passwordIndex += 1
-                if passwordIndex >= len(rootPasswords):
-                    raise Exception("could not determine root password on all machines")
-                child.sendline(rootPasswords[passwordIndex])
-                continue
-            if index == 2:
-                done = True
-                break
-            if index == 3:
-                logger.error("Timeout running command: %s" % cmdStr)
-                break
-
-    except Exception, e:
-        logger.info("Error running cmd: %s" % cmdStr)
-        logger.info(e.__str__())
-
-    if done:
-        child.close()
-        if child.exitstatus:
-            logger.info("Cmd '%s' failed with error code %s" % (cmdStr, child.exitstatus))
-        else:
-            return False
-
-    # using the supplied password did not work... lets try again in interactive mode
-    logger.info("gppsh-exkeys failed running from within pexpect ... now try outside of pexpect")
-    return interactiveCommand(cmdStr)
-
-
-def earlyExit(error = False):
-    if error:
-        logger.fatal("early exit from gpseginstall")
-    if pool:
-        try:
-            pool.join()
-            pool.haltWork()
-            pool.joinWorkers()
-        except KeyboardInterrupt:
-            logger.info("Exiting, please wait ...")
-
-    if error:
-        sys.exit(1)
-    else:
-        logger.info("SUCCESS -- Requested commands completed")
-        sys.exit(0)
-
-if (parseargs()):
-    sys.exit(0)
-
-pool = WorkerPool()
-
-try:
-
-    if (readHostList()):
-        earlyExit(True)
-
-    if (discoverPasswordMap()):
-        earlyExit(True)
-
-    if (dedupeHosts()):
-        earlyExit(True)
-
-    if 'u' in commands:
-        if (checkUsernames()):
-            earlyExit(True)
-    
-        if (addUserIfRequired()):
-            earlyExit(True)
-    
-    if 'c' in commands:
-        if (chownMasterSoftware()):
-            earlyExit(True)
-    
-    if 's' in commands:
-        if (copyOverSoftware()):
-            earlyExit(True)
-    
-    if 'p' in commands:
-        if (changeUserPassword()):
-            earlyExit(True)
-    
-    if 'E' in commands:
-        if (exchangeKeysRoot()):
-            earlyExit(True)
-    
-    if 'e' in commands:
-        if (exchangeKeysUser()):
-            earlyExit(True)
-    
-    if 'l' in commands:
-        if (checkAndFixUserLimits()):
-            earlyExit(True)
-    
-    if 'v' in commands:
-        if (verifySoftware()):
-            earlyExit(True)
-
-except KeyboardInterrupt:
-    logger.info("Job stopped by user")
-    earlyExit(True)
-    
-earlyExit(False)

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8ec87e6a/tools/bin/lib/gpcreateseg.sh
----------------------------------------------------------------------
diff --git a/tools/bin/lib/gpcreateseg.sh b/tools/bin/lib/gpcreateseg.sh
deleted file mode 100755
index dcc3bdc..0000000
--- a/tools/bin/lib/gpcreateseg.sh
+++ /dev/null
@@ -1,331 +0,0 @@
-#!/bin/bash
-#	Filename:-		gpcreateseg.sh
-#	Version:-		$Revision$
-#	Updated:-		$Date$	
-#	Status:-		Released	
-#	Author:-		G Coombe	
-#	Contact:-		gcoombe@greenplum.com
-#	Release date:-		Dec 2006
-#	Release stat:-		Released
-#                               Copyright (c) Metapa 2005. All Rights Reserved.
-#                               Copyright (c) 2007 Greenplum Inc
-#******************************************************************************
-# Update History
-#******************************************************************************
-# Ver	Date		Who		Update
-#******************************************************************************
-# Detailed Description
-#******************************************************************************
-#******************************************************************************
-# Prep Code
-
-WORKDIR=`dirname $0`
-
-# Source required functions file, this required for script to run
-# exit if cannot locate this file. Change location of FUNCTIONS variable
-# as required.
-FUNCTIONS=$WORKDIR/gp_bash_functions.sh
-if [ -f $FUNCTIONS ]; then
-    . $FUNCTIONS
-else
-    echo "[FATAL]:-Cannot source $FUNCTIONS file Script Exits!"
-    exit 2
-fi
-
-#******************************************************************************
-# Script Specific Variables
-#******************************************************************************
-# Log file that will record script actions
-CUR_DATE=`$DATE +%Y%m%d`
-TIME=`$DATE +%H%M%S`
-PROG_NAME=`$BASENAME $0`
-# Level of script feedback 0=small 1=verbose
-unset VERBOSE
-unset PG_CONF_ADD_FILE
-# MPP database specific parameters
-GP_USER=$USER_NAME
-GP_TBL=gp_id
-# System table names
-GP_CONFIGURATION_TBL=gp_segment_configuration
-EXIT_STATUS=0
-# ED_PG_CONF search text values
-PORT_TXT="#port"
-LOG_STATEMENT_TXT="#log_statement ="
-LISTEN_ADR_TXT="listen_addresses"
-CHKPOINT_SEG_TXT="checkpoint_segments"
-TMP_PG_HBA=/tmp/pg_hba_conf_master.$$
-
-#******************************************************************************
-# Functions
-#******************************************************************************
-USAGE () {
-    $ECHO
-    $ECHO "      `basename $0`"
-    $ECHO
-    $ECHO "      Script called by gpinitsystem, this should not"
-    $ECHO "      be run directly"
-    exit $EXIT_STATUS
-}
-
-CHK_CALL () {
-	FILE_PREFIX=`$ECHO $PARALLEL_STATUS_FILE|$CUT -d"." -f1`
-	if [ ! -f ${FILE_PREFIX}.$PARENT_PID ];then
-		$ECHO "[FATAL]:-Not called from correct parent program" 
-		exit 2
-	fi
-}
-
-SET_VAR () {
-    # 
-    # MPP-13617: If segment contains a ~, we assume ~ is the field delimiter.
-    # Otherwise we assume : is the delimiter.  This allows us to easily 
-    # handle IPv6 addresses which may contain a : by using a ~ as a delimiter. 
-    # 
-    I=$1
-    case $I in
-        *~*)
-	    S="~"
-            ;;
-        *)
-	    S=":"
-            ;;
-    esac
-    GP_HOSTADDRESS=`$ECHO $I|$CUT -d$S -f1`
-    GP_PORT=`$ECHO $I|$CUT -d$S -f2`
-    GP_DIR=`$ECHO $I|$CUT -d$S -f3`
-    GP_DBID=`$ECHO $I|$CUT -d$S -f4`
-    GP_CONTENT=`$ECHO $I|$CUT -d$S -f5`
-}
-
-PARA_EXIT () {
-	if [ $1 -ne 0 ];then
-		$ECHO "FAILED:$SEGMENT_LINE" >> $PARALLEL_STATUS_FILE
-		LOG_MSG "[FATAL][$INST_COUNT]:-Failed $2"
-		exit 2
-	else
-		LOG_MSG "[INFO][$INST_COUNT]:-Completed $2"
-	fi
-}
-
-PROCESS_QE () {
-
-    LOG_MSG "[INFO][$INST_COUNT]:-Start Function $FUNCNAME"
-    LOG_MSG "[INFO][$INST_COUNT]:-Processing segment $GP_HOSTADDRESS"
-
-    MIRROR_ONLY_INITDB_OPTION=
-    if [ x"" != x"$COPY_FROM_PRIMARY_HOSTADDRESS" ]; then
-	MIRROR_ONLY_INITDB_OPTION=-m
-    fi
-
-    # build initdb command, capturing output in ${GP_DIR}.initdb
-    cmd="$EXPORT_LIB_PATH;$INITDB"
-    cmd="$cmd $MIRROR_ONLY_INITDB_OPTION"
-    cmd="$cmd -E $ENCODING"
-    cmd="$cmd -D $GP_DIR"
-    cmd="$cmd --locale=$LOCALE_SETTING"
-    cmd="$cmd $LC_ALL_SETTINGS"
-    cmd="$cmd --max_connections=$QE_MAX_CONNECT"
-    cmd="$cmd --shared_buffers=$QE_SHARED_BUFFERS"
-    cmd="$cmd --backend_output=$GP_DIR.initdb"
-
-    $TRUSTED_SHELL ${GP_HOSTADDRESS} $cmd >> $LOG_FILE 2>&1
-    RETVAL=$?
-
-    # if there was an error, copy ${GP_DIR}.initdb to the log before cleaning it up
-    if [ $RETVAL -ne 0 ]; then
-	$TRUSTED_SHELL ${GP_HOSTADDRESS} "cat $GP_DIR.initdb" >> $LOG_FILE 2>&1
-    fi
-    $TRUSTED_SHELL ${GP_HOSTADDRESS} "rm -f $GP_DIR.initdb" >> $LOG_FILE 2>&1
-    BACKOUT_COMMAND "$TRUSTED_SHELL ${GP_HOSTADDRESS} \"$RM -rf $GP_DIR > /dev/null 2>&1\""
-    BACKOUT_COMMAND "$ECHO \"removing directory $GP_DIR on $GP_HOSTADDRESS\""
-    PARA_EXIT $RETVAL "to start segment instance database $GP_HOSTADDRESS $GP_DIR"
-
-    # on mirror, copy data from primary
-    if [ x"" != x"$COPY_FROM_PRIMARY_HOSTADDRESS" ]; then
-        LOG_MSG "[INFO]:-Copying data for mirror on ${GP_HOSTADDRESS} using remote copy from primary ${COPY_FROM_PRIMARY_HOSTADDRESS} ..." 1
-        RUN_COMMAND_REMOTE ${COPY_FROM_PRIMARY_HOSTADDRESS} "${EXPORT_GPHOME}; . ${GPHOME}/greenplum_path.sh; ${GPHOME}/bin/lib/pysync.py -x pg_log -x postgresql.conf -x postmaster.pid ${COPY_FROM_PRIMARY_DIR} \[${GP_HOSTADDRESS}\]:${GP_DIR}"
-        RETVAL=$?
-        PARA_EXIT $RETVAL "remote copy of segment data directory from ${COPY_FROM_PRIMARY_HOSTADDRESS} to ${GP_HOSTADDRESS}"
-    fi
-
-    # Configure postgresql.conf
-    LOG_MSG "[INFO][$INST_COUNT]:-Configuring segment $PG_CONF"
-    $TRUSTED_SHELL ${GP_HOSTADDRESS} "$ECHO \"#MPP Specific parameters\" >> ${GP_DIR}/$PG_CONF"
-    RETVAL=$?
-    PARA_EXIT $RETVAL "Update ${GP_DIR}/$PG_CONF file"
-    $TRUSTED_SHELL ${GP_HOSTADDRESS} "$ECHO \"#----------------------\" >> ${GP_DIR}/$PG_CONF"
-    RETVAL=$?
-    PARA_EXIT $RETVAL "Update ${GP_DIR}/$PG_CONF file"
-    ED_PG_CONF ${GP_DIR}/$PG_CONF "$PORT_TXT" port=$GP_PORT 0 $GP_HOSTADDRESS
-    PARA_EXIT $RETVAL "Update port number to $GP_PORT"
-    ED_PG_CONF ${GP_DIR}/$PG_CONF "$LISTEN_ADR_TXT" listen_addresses=\'*\' 0 $GP_HOSTADDRESS
-    PARA_EXIT $RETVAL "Update listen address"
-    ED_PG_CONF ${GP_DIR}/$PG_CONF "$CHKPOINT_SEG_TXT" checkpoint_segments=$CHECK_POINT_SEGMENTS 0 $GP_HOSTADDRESS
-    PARA_EXIT $RETVAL "Update checkpoint segments"
-
-    if [ x"" != x"$PG_CONF_ADD_FILE" ]; then
-	LOG_MSG "[INFO][$INST_COUNT]:-Processing additional configuration parameters"
-	for NEW_PARAM in `$CAT $PG_CONF_ADD_FILE|$TR -s ' '|$TR -d ' '|$GREP -v "^#"`
-	do
-	    LOG_MSG "[INFO][$INST_COUNT]:-Adding config $NEW_PARAM to segment"
-	    SEARCH_TXT=`$ECHO $NEW_PARAM |$CUT -d"=" -f1`
-	    ED_PG_CONF ${GP_DIR}/$PG_CONF $SEARCH_TXT $NEW_PARAM 0 $GP_HOSTADDRESS
-	    PARA_EXIT $RETVAL "Update $PG_CONF $SEARCH_TXT $NEW_PARAM"
-	done
-    fi
-
-    # Configuring PG_HBA  -- on mirror, only need to add local addresses (skip the other addresses)
-    LOG_MSG "[INFO][$INST_COUNT]:-Configuring segment $PG_HBA"
-    if [ x"" = x"$COPY_FROM_PRIMARY_HOSTADDRESS" ]; then
-	for MASTER_IP in "${MASTER_IP_ADDRESS[@]}"
-	do
-	    # MPP-15889
-	    CIDR_MASTER_IP=$(GET_CIDRADDR $MASTER_IP)
-	    $TRUSTED_SHELL ${GP_HOSTADDRESS} "$ECHO host	all	all	${CIDR_MASTER_IP}	trust >> ${GP_DIR}/$PG_HBA"
-	    PARA_EXIT $? "Update $PG_HBA for master IP address ${CIDR_MASTER_IP}"
-	done
-	if [ x"" != x"$STANDBY_HOSTNAME" ];then
-	    LOG_MSG "[INFO][$INST_COUNT]:-Processing Standby master IP address for segment instances"
-	    for STANDBY_IP in "${STANDBY_IP_ADDRESS[@]}"
-	    do
-	        # MPP-15889
-	        CIDR_STANDBY_IP=$(GET_CIDRADDR $STANDBY_IP)
-		$TRUSTED_SHELL ${GP_HOSTADDRESS} "$ECHO host	all	all	${CIDR_STANDBY_IP}	trust >> ${GP_DIR}/$PG_HBA"
-		PARA_EXIT $? "Update $PG_HBA for master standby address ${CIDR_STANDBY_IP}"
-	    done
-	fi
-    fi
-
-    # Add all local IPV4 addresses
-    SEGMENT_IPV4_LOCAL_ADDRESS_ALL=(`$TRUSTED_SHELL $GP_HOSTADDRESS "$IFCONFIG $IFCONFIG_TXT |$GREP \"inet \"|$GREP -v \"127.0.0\"|$AWK '{print \\$2}'|$CUT -d: -f2"`)
-    for ADDR in "${SEGMENT_IPV4_LOCAL_ADDRESS_ALL[@]}"
-    do
-	# MPP-15889
-	CIDR_ADDR=$(GET_CIDRADDR $ADDR)
-        $TRUSTED_SHELL ${GP_HOSTADDRESS} "$ECHO host     all          $USER_NAME         $CIDR_ADDR      trust >> ${GP_DIR}/$PG_HBA"
-    done
-
-    # Add all local IPV6 addresses
-    SEGMENT_IPV6_LOCAL_ADDRESS_ALL=(`$TRUSTED_SHELL $GP_HOSTADDRESS "$IPV6_ADDR_LIST_CMD | $GREP inet6 | $AWK '{print \\$2}' |$CUT -d'/' -f1"`)
-    for ADDR in "${SEGMENT_IPV6_LOCAL_ADDRESS_ALL[@]}"
-    do
-	# MPP-15889
-	CIDR_ADDR=$(GET_CIDRADDR $ADDR)
-	$TRUSTED_SHELL ${GP_HOSTADDRESS} "$ECHO host     all          $USER_NAME         $CIDR_ADDR      trust >> ${GP_DIR}/$PG_HBA"
-    done
-
-    # Create temp directories file
-    LOG_MSG "[INFO][$INST_COUNT]:-temporary directory: $TEMP_DIRECTORY_LIST"
-    if [ "${#TEMP_DIRECTORY_LIST[*]}" -ne 0 ]; then
-        BACKOUT_COMMAND "$TRUSTED_SHELL ${GP_HOSTADDRESS} \"$RM -rf ${GP_DIR}/${GP_TEMP_DIRECTORIES_FILE} > /dev/null 2>&1\""
-    fi
-    for DIR in "${TEMP_DIRECTORY_LIST[@]}"
-    do
-        tmp_seg_dir="${DIR}/${SEG_PREFIX}${GP_CONTENT}"
-        LOG_MSG "[INFO]:-create temporary ${tmp_seg_dir}"
-        BACKOUT_COMMAND "$TRUSTED_SHELL ${GP_HOSTADDRESS} \"$RM -rf ${tmp_seg_dir} > /dev/null 2>&1\""
-        $TRUSTED_SHELL ${GP_HOSTADDRESS} "$MKDIR ${tmp_seg_dir}"
-        RETVAL=$?
-        if [ $RETVAL -ne 0 ]; then
-            # should not happen, we check the permission in gpinitsystem.
-            LOG_MSG "[FATAL]:-temp directory created failed: ${tmp_seg_dir}"
-            exit 2
-        fi
-        $TRUSTED_SHELL ${GP_HOSTADDRESS} "$ECHO ${tmp_seg_dir} >> ${GP_DIR}/${GP_TEMP_DIRECTORIES_FILE}"
-    done
-
-    if [ x"" = x"$COPY_FROM_PRIMARY_HOSTADDRESS" ]; then
-	# Primary: start the segment to fill in configuration
-	START_QE
-	UPDATE_MPP $GP_PORT "$ARRAY_NAME" $TOTAL_SEG $GP_DBID $GP_CONTENT 1 $GP_HOSTADDRESS $GP_DIR
-	STOP_QE
-    fi
-
-    LOG_MSG "[INFO]:-[$INST_COUNT]-End Function $FUNCNAME"
-}
-
-STOP_QE() {
-    # we don't add backout commands here.  We could get double-stop calls since the same QE is sometimes started, stopped, and restarted.  But hopefully that's okay
-
-    LOG_MSG "[INFO]:-Start Function $FUNCNAME" 1
-    LOG_MSG "[INFO]:-Stopping instance on segment ${GP_HOSTADDRESS}:${GP_PORT}" 1
-    $TRUSTED_SHELL ${GP_HOSTADDRESS} "$EXPORT_LIB_PATH;export PGPORT=${GP_PORT}; $PG_CTL -w -l $GP_DIR/pg_log/startup.log -D $GP_DIR -o \"-i -p ${GP_PORT}\" stop" >> $LOG_FILE 2>&1
-    LOG_MSG "[INFO]:-End Function $FUNCNAME"
-}
-
-START_QE() {
-	LOG_MSG "[INFO][$INST_COUNT]:-Starting Functioning instance on segment ${GP_HOSTADDRESS}"
-	$TRUSTED_SHELL ${GP_HOSTADDRESS} "$EXPORT_LIB_PATH;export PGPORT=${GP_PORT}; $PG_CTL -w -l $GP_DIR/pg_log/startup.log -D $GP_DIR -o \"-i -p ${GP_PORT} -M mirrorless -b ${GP_DBID} -C ${GP_CONTENT} -z 0\" start" >> $LOG_FILE 2>&1
-	RETVAL=$?
-	if [ $RETVAL -ne 0 ]; then
-		BACKOUT_COMMAND "$TRUSTED_SHELL $GP_HOSTADDRESS \"${EXPORT_LIB_PATH};export PGPORT=${GP_PORT}; $PG_CTL -w -D $GP_DIR -o \"-i -p ${GP_PORT}\" -m immediate  stop\""
-		BACKOUT_COMMAND "$ECHO \"Stopping segment instance on $GP_HOSTADDRESS\""
-		$TRUSTED_SHELL ${GP_HOSTADDRESS} "$CAT ${GP_DIR}/pg_log/startup.log "|$TEE -a $LOG_FILE
-		PARA_EXIT $RETVAL "Start segment instance database"
-	fi	
-	BACKOUT_COMMAND "$TRUSTED_SHELL $GP_HOSTADDRESS \"${EXPORT_LIB_PATH};export PGPORT=${GP_PORT}; $PG_CTL -w -D $GP_DIR -o \"-i -p ${GP_PORT}\" -m immediate  stop\""
-	BACKOUT_COMMAND "$ECHO \"Stopping segment instance on $GP_HOSTADDRESS\""
-	LOG_MSG "[INFO][$INST_COUNT]:-Successfully started segment instance on $GP_HOSTADDRESS"
-}
-
-#******************************************************************************
-# Main Section
-#******************************************************************************
-trap '$ECHO "KILLED:$SEGMENT_LINE" >> $PARALLEL_STATUS_FILE;ERROR_EXIT "[FATAL]:-[$INST_COUNT]-Recieved INT or TERM signal" 2' INT TERM
-while getopts ":v'?'aiqe:c:l:p:m:h:on:s:" opt
-do
-	case $opt in
-		v ) VERSION_INFO ;;
-		'?' ) USAGE ;;
-		q ) unset VERBOSE ;;
-	        p ) PG_CONF_ADD_FILE=$OPTARG
-		    shift
-		    shift ;;
-		* ) USAGE 
-	esac
-done
-
-#Now process supplied call parameters
-PARENT_PID=$1;shift		#PID of calling gpinitsystem program
-CHK_CALL
-
-TYPE=$1;shift
-case $TYPE in
-	1 )
-		SEGMENT_LINE=$1;shift		#String used to build segment instance
-        COPY_FROM_PRIMARY_SEGMENT_LINE=$1;shift # String used to build primary segment instance from which to copy data
-		if [ x"IS_PRIMARY" != x"$COPY_FROM_PRIMARY_SEGMENT_LINE" ]; then
-			SET_VAR $COPY_FROM_PRIMARY_SEGMENT_LINE
-			COPY_FROM_PRIMARY_HOSTADDRESS=$GP_HOSTADDRESS
-			COPY_FROM_PRIMARY_DIR=$GP_DIR
-			COPY_FROM_PRIMARY_PORT=$GP_PORT
-            COPY_FROM_PRIMARY_CONTENT=$GP_CONTENT
-		fi
-		SET_VAR $SEGMENT_LINE
-
-        if [ x"IS_PRIMARY" != x"$COPY_FROM_PRIMARY_SEGMENT_LINE" ]; then
-            if [ x"$GP_CONTENT" != x"$COPY_FROM_PRIMARY_CONTENT" ]; then
-                $ECHO "[FATAL]:-mismatch between content id and primary content id" 
-		        exit 2
-            fi
-        fi
-        TEMP_DIRECTORY_COMPACT_LIST=$1;shift
-        TEMP_DIRECTORY_LIST=(`$ECHO ${TEMP_DIRECTORY_COMPACT_LIST[@]} | $TR ',' ' '`)
-        SEG_PREFIX=$1;shift
-        IS_FILEREP_MIRRORED_OPTION=$1;shift # yes or no, should we tell initdb to create persistent values
-		INST_COUNT=$1;shift		#Unique number for this parallel script, starts at 0
-		BACKOUT_FILE=/tmp/gpsegcreate.sh_backout.$$
-		LOG_FILE=$1;shift		#Central logging file
-		LOG_MSG "[INFO][$INST_COUNT]:-Start Main"
-		LOG_MSG "[INFO][$INST_COUNT]:-Command line options passed to utility = $*"
-		TMP_MASTER_IP_ADDRESS=$1;shift	#List of IP addresses for the master instance
-		MASTER_IP_ADDRESS=(`$ECHO $TMP_MASTER_IP_ADDRESS|$TR '~' ' '`)
-		TMP_STANDBY_IP_ADDRESS=$1;shift #List of IP addresses for standby master
-		STANDBY_IP_ADDRESS=(`$ECHO $TMP_STANDBY_IP_ADDRESS|$TR '~' ' '`)
-		PROCESS_QE
-		$ECHO "COMPLETED:$SEGMENT_LINE" >> $PARALLEL_STATUS_FILE
-		;;
-esac
-
-LOG_MSG "[INFO][$INST_COUNT]:-End Main"
-exit $EXIT_STATUS

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8ec87e6a/tools/bin/lib/gpinitsegment
----------------------------------------------------------------------
diff --git a/tools/bin/lib/gpinitsegment b/tools/bin/lib/gpinitsegment
deleted file mode 100755
index e79c158..0000000
--- a/tools/bin/lib/gpinitsegment
+++ /dev/null
@@ -1,542 +0,0 @@
-#!/usr/bin/env python 
-# ==============================================================================
-'''
-Usage: gpinitsegment [options]
-
-Options:
-  -l, --logdir
-  -c, --content
-  -h, --host
-  -i, --dbid
-  -n, --numseg  
-  -p, --port  
-  -A, --array-name
-  -C, --copy 
-  -D, --datadir
-  -E, --client_encoding
-  -G, --gphome
-  -K, --checkpoint_segments
-  -L, --locale
-  -M, --max_connnections
-'''
-
-# TODO MIRRORING: NEED TO TAKE in replicationPort
-
-import sys, os, re, optparse
-import time, datetime
-import signal, subprocess, tempfile
-
-EXECNAME  = os.path.split(__file__)[1]
-os_type   = os.uname()[0].lower()
-localhost = os.uname()[1]
-
-# ==============================================================================
-class SegmentError(Exception): pass
-
-
-# ==============================================================================
-def ParseInput():
-    '''
-    Parse input
-    '''
-    try:
-        parser = optparse.OptionParser(usage=__doc__, 
-                                       add_help_option=False)
-        parser.add_option('-?', '--help', action='store_true',
-                          help=optparse.SUPPRESS_HELP)
-        parser.add_option('-l', '--logdir', 
-                          help=optparse.SUPPRESS_HELP)
-        parser.add_option('-h', '--host', 
-                          help=optparse.SUPPRESS_HELP)
-        parser.add_option('-A', '--array-name', dest='cluster',
-                          help=optparse.SUPPRESS_HELP)
-        parser.add_option('-p', '--port', type='int',
-                          help=optparse.SUPPRESS_HELP)
-        parser.add_option('-c', '--content', type='int',
-                          help=optparse.SUPPRESS_HELP)
-        parser.add_option('-i', '--dbid', type='int',
-                          help=optparse.SUPPRESS_HELP)
-        parser.add_option('-n', '--numseg', type='int',
-                          help=optparse.SUPPRESS_HELP)
-        parser.add_option('-D', '--datadir', 
-                          help=optparse.SUPPRESS_HELP)
-        parser.add_option('-C', '--copy', 
-                          help=optparse.SUPPRESS_HELP)
-        parser.add_option('-G', '--gphome', 
-                          help=optparse.SUPPRESS_HELP)
-        parser.add_option('-K', '--checkpoint_segments',
-                          help=optparse.SUPPRESS_HELP)
-        parser.add_option('-E', '--client_encoding',
-                          help=optparse.SUPPRESS_HELP)
-        parser.add_option('-L', '--locale',
-                          help=optparse.SUPPRESS_HELP)
-        parser.add_option('-M', '--max_connections',
-                          help=optparse.SUPPRESS_HELP)
-        (options, args) = parser.parse_args()
-
-        if options.help:
-            print __doc__
-            sys.exit(0)
-
-        elif len(args) > 0:
-            print __doc__
-            sys.exit(1)
-
-    except Exception, e:
-        print __doc__
-        print 'Error parsing input: '
-        raise e
-
-    return options
-
-def RunCmd(cmd, env):
-    try:
-        pipe = subprocess.Popen(cmd, shell=True, env=env,
-                                stdout=subprocess.PIPE, 
-                                stderr=subprocess.PIPE)
-    except OSError, e:
-        raise SegmentError(cmd.split(' ')[0] + ' : ' +  str(e))
-
-    try:
-        result = pipe.communicate();
-    except OSError, e:
-        raise SegmentError(cmd + ' : ' +  str(e))
-
-    if (pipe.returncode):
-        print result[0].strip()
-        print result[1].strip()
-        raise SegmentError(cmd + ' : returned ' + str(pipe.returncode))
-
-    return result[0].strip()
-    
-
-# ==============================================================================
-class GPInitSegment():
-
-    #----------------------------------------------------------------------
-    def __init__(self, options=None):
-        '''
-        Sets the default values for a master segment
-        '''
-
-        home = os.environ.get('HOME')
-        
-        self.logfile  = None
-        
-        def notNone(a,b):
-            if a != None: return a
-            return b
-
-        if home == None:
-            self.logdir = options.logdir
-        else:
-            self.logdir = notNone(options.logdir, 
-                                  os.path.join(home, 'gpAdminLogs'))        
-        if not os.path.exists(self.logdir):
-            self.logdir = None
-
-        self.host     = notNone(options.host, localhost)
-        self.cluster  = notNone(options.cluster, 'Greenplum')
-        self.port     = notNone(options.port, '5432')
-        self.content  = notNone(options.content, '-1')
-        self.dbid     = notNone(options.dbid, '1')
-        self.numseg   = notNone(options.numseg, '-1')
-        self.dir      = notNone(options.datadir,  
-                                os.environ.get('MASTER_DATA_DIRECTORY'))
-        self.gphome   = options.gphome or os.environ.get('GPHOME')
-        self.source   = options.copy
-        self.encoding = options.client_encoding
-        self.checkseg = options.checkpoint_segments
-        self.locale   = options.locale
-        self.maxconn  = options.max_connections
-
-        self.user     = os.environ.get('USER') or os.environ.get('LOGNAME')
-
-        if not self.gphome:
-            print "Could not determine GPHOME"
-            sys.exit(0)
-
-        if int(self.numseg) <= 0:
-            print "Total number of segments must be > 0"
-            sys.exit(1)
-
-        if self.dir[0] != '/':
-            self.dir = os.path.join(os.getcwd(), self.dir)
-
-        if self.logdir:
-            today = datetime.date.today().strftime('%Y%m%d')
-            logname = os.path.join(self.logdir, '%s_%s.log' % (EXECNAME, today))
-            self.logfile = open(logname, 'a')            
-        
-
-        self.env = {}
-        self.env['HOME']    = os.environ.get('HOME')
-        self.env['USER']    = self.user
-        self.env['LOGNAME'] = self.user
-        self.env['GPHOME']  = self.gphome
-
-        # Need to establish an environment to run commands in
-        # + Add $GPHOME/bin to the path for this environment
-        # + Add /sbin to the path for ifconfig
-        path = os.environ.get('PATH') or ''
-        path = '%s/bin:%s/ext/python/bin:/sbin:%s' % (self.gphome, self.gphome, path)
-        self.env['PATH'] = path
-
-        path = os.environ.get('LD_LIBRARY_PATH') or ''
-        path = '%s/lib:%s/ext/python/lib:%s' % (self.gphome, self.gphome, path)
-        self.env['LD_LIBRARY_PATH'] = path
-
-        path = os.environ.get('DYLD_LIBRARY_PATH') or ''
-        path = '%s/lib:%s/ext/python/lib:%s' % (self.gphome, self.gphome, path)
-        self.env['DYLD_LIBRARY_PATH'] = path
-
-    #----------------------------------------------------------------------
-    def CreateSegment(self):
-        '''
-        Creates the new segment via one of three main methods:
-           1) Executes gpinitsegment on remote host
-           2) Runs initdb in the directory
-           3) Copies the data directory from to source location
-        '''
-        if self.host != localhost:
-            self.ExecuteRemote()
-        elif self.source:
-            self.CopySeg()
-        else:
-            self.InitSeg()
-
-    #----------------------------------------------------------------------
-    def ExecuteRemote(self):
-        '''
-        Remote execution strategy is simply to use ssh to call 
-        gpinitsegment on the remote host. 
-        '''
-
-        self.Log('INFO', 'Executing initseg remotely on %s' % self.host)
-
-        ENV      = '%s/bin/lib/gpenv.sh' % self.gphome
-        cmd  = 'ssh %s %s %s' % (self.host, ENV, __file__)
-        cmd += ' -G %s' % self.gphome
-        cmd += ' -A \'\\"%s\\"\'' % self.cluster
-        cmd += ' -p %s' % self.port
-        cmd += ' -c %s' % self.content
-        cmd += ' -i %s' % self.dbid
-        cmd += ' -n %s' % self.numseg
-        cmd += ' -D %s' % self.dir
-
-        # If using "--copy" then the current hostname will be prefixed 
-        # to the copy source if a hostname is not already specified
-        if self.source:
-
-            source_re = re.compile('(?:([^:]+)\:(\d*))?(.*)')
-            m = source_re.match(self.source)
-            if not m:
-                raise SegmentError("Invalid source description: '%s'" % self.source)
-            s_host = m.group(1)
-            s_port = m.group(2)
-            s_dir  = m.group(3)
-
-            # make s_dir into a full path
-            if s_dir[0] != '/':
-                s_dir = os.path.join(os.getcwd(), s_dir)
-
-            if s_host == None:
-                s_host = localhost
-
-            cmd += ' -C %s:%s' % (s_host, s_dir)
-
-        result = RunCmd(cmd, self.env)
-        if (self.logfile):
-            self.logfile.write(result + "\n")
-        sys.stdout.write(result + "\n")
-
-
-    #----------------------------------------------------------------------
-    def Log(self, type, msg):
-        '''
-        Writes a message to stderr and the logfile
-        '''
-        prefix = ':'.join(
-            [time.strftime('%Y%m%d:%H:%M:%S', time.localtime()), EXECNAME, 
-             self.host, self.user, '[%s]' % type, '-'])
-
-        for m in msg.splitlines():
-            if m.strip() == '': 
-                continue
-
-            if (self.logfile):
-                self.logfile.write('%s%s\n' % (prefix, m))
-                self.logfile.flush()
-
-            sys.stdout.write('%s%s\n' % (prefix, m))
-
-    #----------------------------------------------------------------------
-    def MakeDirectory(self):
-        '''
-        Creates the directory for the segment
-        '''
-        self.Log('INFO', 'Creating data directory: %s' % self.dir)
-
-        if os.path.exists(self.dir):
-            raise SegmentError("'%s' already exists" % self.dir)
-
-        (path, dir) = os.path.split(self.dir)
-
-        if not os.path.exists(path):
-            raise SegmentError("'%s' does not exist" % path)
-
-        if not os.access(path, os.W_OK):
-            raise SegmentError("'%s' no write permission" % path)
-
-        try:
-            os.mkdir(self.dir)
-            RunCmd('chmod 700 ' + self.dir, self.env)
-        except Exception, e:
-            raise SegmentError(str(e))
-
-    #----------------------------------------------------------------------
-    def SetPort(self):
-        '''
-        Modifies postgresql.conf file to have the correct port
-        '''
-
-        self.Log('INFO', 'Setting port')
-        
-        if not os.path.exists(self.dir):
-            raise SegmentError("'%s' does not exist" % self.dir)
-        pidfile = os.path.join(self.dir, 'postmaster.pid')
-        if os.path.exists(pidfile):
-            raise SegmentError("Can not adjust port when segment is running")
-        
-        conf = os.path.join(self.dir, 'postgresql.conf')
-        if not os.path.exists(conf):
-            raise SegmentError("'%s' does not exist" % conf)
-
-        # Rewrite the postgresql.conf file
-        port_re   = re.compile('#?port\s*=\s*\d+.*')
-        chkpnt_re = re.compile('#?checkpoint_segments\s*=\s*\d+.*')
-        encode_re = re.compile('#?client_encoding\s*=\s*\w+.*')
-        old = open(conf, 'r')
-        new = open(conf+'.new', 'w')
-        for line in old:
-            if port_re.match(line):
-                new.write('port = %s     # sets the database listener port\n'
-                          % self.port)
-            elif (self.checkseg and chkpnt_re.match(line)):
-                new.write('checkpoint_segments = %s     # in logfile segments, min 1, 16MB each\n'
-                          % self.checkseg)
-            elif (self.encoding and encode_re.match(line)):
-                new.write('client_encoding = %s     # default database encoding\n'
-                          % self.encoding)
-            else:
-                new.write(line)
-
-        # Replace the old file with the new one
-        os.rename(conf+'.new', conf)
-
-    def SetHba(self):
-        '''
-        Modifies pg_hba.conf file to allow access
-        '''
-
-        self.Log('INFO', 'Configuring pg_hba.conf')
-
-        # Customize for OS
-        if os_type == 'sunos':
-            cmd = 'ifconfig -a inet'
-        else:
-            cmd = 'ifconfig'
-
-        # open pg_hba.conf for writing
-        pg_hba = open(os.path.join(self.dir, 'pg_hba.conf'), 'w')
-
-        # Add an entry for local connections by the admin user
-        if os_type == 'sunos':
-            pg_hba.write('local all all trust\n')
-        else:
-            pg_hba.write('local all %s ident\n' % self.user)
-
-        # Find all known ip addresses that this host identifies with
-        ifconf = RunCmd(cmd, self.env)
-        ip_re = re.compile('inet (?:addr:)?(\d+\.\d+\.\d+\.\d+)')
-        for line in ifconf.split('\n'):
-            m = ip_re.search(line)
-            if m:
-                ip = m.group(1)
-                cidr_suffix = '/128' if ':' in ip else '/32' # MPP-15889
-                pg_hba.write('host all all %s%s trust\n' % (ip, cidr_suffix))
-
-        pg_hba.close()
-
-
-    #----------------------------------------------------------------------
-    def SetIdentity(self):
-        '''
-        Modifies gp_id for the segment in both postgres and template1 dbs
-        '''
-
-        ident = "('%s', %s, %s, %s)" % \
-            (self.cluster, self.numseg, self.dbid, self.content)
-        self.Log('INFO', 'Setting identity %s' % ident)
-
-        options = "PGOPTIONS='-c gp_session_role=utility'"
-        psql    = options + ' psql -p %s' % self.port
-
-        def runSQL(sql):
-            r = subprocess.call(psql + ' -c "%s" template1' % sql,
-                                shell=True,
-                                stdout=self.logfile,
-                                stderr=self.logfile)
-            if r != 0:
-                raise SegmentError('Error Executing SQL (return code %s)' % str(r))
-
-        runSQL("delete from gp_id")
-        runSQL("insert into gp_id values %s" % ident)
-        runSQL("vacuum freeze gp_id")
-
-
-    #----------------------------------------------------------------------
-    def Startup(self):
-        '''
-        Uses pg_ctl to startup the database:
-          + pg_ctl will wait for the startup to complete
-          + pg_ctl may gives up after about a minute if the startup fails
-        '''
-
-        self.Log('INFO', "Starting Greenplum (port=%s, dir=%s)" 
-                 % (self.port, self.dir))
-
-        cmd  = 'pg_ctl start -w -D %s -l %s.log' % (self.dir, self.dir)
-        cmd += ' -o "-i -p %s -c gp_role=utility"' % str(self.port)
-        self.Log('INFO', cmd)
-        retcode = subprocess.call(cmd, shell=True, env=self.env)
-        if retcode != 0:
-            raise SegmentError('Segment failed to startup, pg_ctl returned %s' 
-                               % str(retcode))
-
-
-    #----------------------------------------------------------------------
-    def Shutdown(self):
-        '''
-        Checks for a postmaster.pid file.
-          + If found it calls pg_ctl to stop the database.  
-          + pg_ctl will wait until the database is stopped
-          + pg_ctl may gives up after about a minute if the shutdown fails
-        '''
-
-        if os.path.exists(os.path.join(self.dir, 'postmaster.pid')):
-            self.Log('INFO', "Stopping Greenplum (port=%s, dir=%s)" 
-                     % (self.port, self.dir))
-
-            cmd  = 'pg_ctl stop -D %s -m fast' % self.dir
-            self.Log('INFO', cmd)
-            retcode = subprocess.call(cmd, shell=True, env=self.env)
-            if retcode != 0:
-                raise SegmentError('Segment failed to stop, pg_ctl returned %s' 
-                                   % str(retcode))
-
-
-    #----------------------------------------------------------------------
-    def InitSeg(self):
-        '''
-        
-        '''
-        self.MakeDirectory()
-
-        self.Log('INFO', 'Running initdb')
-
-        try:
-            cmd = 'initdb -D ' + self.dir
-            if self.encoding:
-                cmd += ' -E ' + self.encoding
-            if self.locale:
-                cmd += ' --locale=' + self.locale
-            if self.maxconn:
-                cmd += ' --max_connections=' + self.maxconn
-
-                
-            self.Log('INFO', cmd)
-
-            subprocess.call(cmd, shell=True,
-                            stdout=self.logfile,
-                            stderr=self.logfile)
-        except BaseException, e:
-            try:     
-                os.removedirs(self.dir)
-            except:  pass
-            raise SegmentError(str(e))
-
-        self.SetPort()
-        self.SetHba()
-        self.Startup()
-        self.SetIdentity()
-
-    #----------------------------------------------------------------------
-    def CopySeg(self):
-        '''
-        '''
-        source_re = re.compile('(?:([^:]+)\:(\d*))?(.*)')
-        m = source_re.match(self.source)
-        if not m:
-            raise SegmentError("Invalid source description: '%s'" % self.source)
-        s_host = m.group(1)
-        s_port = m.group(2)
-        s_dir  = m.group(3)
-
-        # make s_dir into a full path
-        if s_dir[0] != '/':
-            s_dir = os.path.join(os.getcwd(), s_dir)
-
-        # Determine what that host thinks its hostname is
-        if not s_host:
-            s_host = localhost
-
-        SSH      = 'ssh %s' % s_host
-        ENV      = '%s/bin/lib/gpenv.sh' % self.gphome
-
-        HOSTNAME = RunCmd('which hostname', self.env)
-        TAR      = RunCmd('which tar', self.env)
-        PG_CTL   = RunCmd('which pg_controldata', self.env)
-        PG_CTL   = '%s %s' % (ENV, PG_CTL)
-
-        # Validate that it's a real data-directory
-        try:
-            ctl = RunCmd('%s %s %s' % (SSH, PG_CTL, s_dir), self.env)
-        except:
-            raise SegmentError("Source Directory '%s' invalid" % s_dir)
-
-        # Everything looks good, get ready to rumble
-        self.MakeDirectory()
-        
-        self.Log('INFO', 'Copying data directory')
-
-        cmd  = "'cd %s && %s -cf - .' | (cd %s && %s -xBf - .)" \
-            % (s_dir, TAR, self.dir, TAR)
-
-        RunCmd("%s %s" % (SSH, cmd), self.env)
-        self.SetPort()
-        self.Startup()
-        self.SetIdentity()
-
-        
-# ==============================================================================
-if __name__ == "__main__":
-    try:
-        options = ParseInput()
-
-        s = GPInitSegment(options)
-        try:
-            s.CreateSegment()
-        except BaseException, e:
-            s.Log('FATAL', str(e))
-            raise Exception('')
-        finally:
-            s.Shutdown()
-            
-        sys.exit(0)
-
-    except Exception, e:
-        print str(e)
-        sys.exit(1)
-
-

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8ec87e6a/tools/bin/lib/gpseginitsb.sh
----------------------------------------------------------------------
diff --git a/tools/bin/lib/gpseginitsb.sh b/tools/bin/lib/gpseginitsb.sh
deleted file mode 100755
index 7484a9d..0000000
--- a/tools/bin/lib/gpseginitsb.sh
+++ /dev/null
@@ -1,113 +0,0 @@
-#!/bin/bash
-#	Filename:-		gpseginitsb.sh
-#	Version:-		$Revision$
-#	Updated:-		$Date$	
-#	Status:-		Released	
-#	Author:-		G Coombe	
-#	Contact:-		gcoombe@greenplum.com
-#	Release date:-		Oct 2007
-#	Release stat:-		Released
-#                               Copyright (c) Metapa 2005. All Rights Reserved.
-#                               Copyright (c) 2007 Greenplum Inc
-#******************************************************************************
-# Update History
-#******************************************************************************
-# Ver	Date		Who		Update
-#******************************************************************************
-# Detailed Description
-#******************************************************************************
-#******************************************************************************
-# Prep Code
-
-WORKDIR=`dirname $0`
-
-# Source required functions file, this required for script to run
-# exit if cannot locate this file. Change location of FUNCTIONS variable
-# as required.
-FUNCTIONS=$WORKDIR/gp_bash_functions.sh
-if [ -f $FUNCTIONS ]; then
-		. $FUNCTIONS
-else
-		echo "[FATAL]:-Cannot source $FUNCTIONS file Script Exits!"
-		exit 2
-fi
-#******************************************************************************
-# Script Specific Variables
-#******************************************************************************
-# Log file that will record script actions
-CUR_DATE=`$DATE +%Y%m%d`
-TIME=`$DATE +%H%M%S`
-PROG_NAME=`$BASENAME $0`
-# Level of script feedback 0=small 1=verbose
-unset VERBOSE
-GP_USER=$USER_NAME
-EXIT_STATUS=0
-#******************************************************************************
-# Functions
-#******************************************************************************
-USAGE () {
-		$ECHO
-		$ECHO "      `basename $0`"
-		$ECHO
-		$ECHO "      Script called by gpinitstandby, this should not be run directly"
-		exit $EXIT_STATUS
-}
-
-CHK_CALL () {
-	FILE_PREFIX=`$ECHO $PARALLEL_STATUS_FILE|$CUT -d"." -f1`
-	if [ ! -f ${FILE_PREFIX}.$PARENT_PID ];then
-		$ECHO "[FATAL]:-Not called from from correct parent program" 
-		exit 2
-	fi
-}
-
-UPDATE_PGHBA () {
-	LOG_MSG "[INFO][$INST_COUNT]:-Start Function $FUNCNAME"
-	STANDBY_IP_ADDRESS=(`$ECHO $IP_ADDRESS_LIST|$TR '~' ' '`)
-	for STANDBY_IP in "${STANDBY_IP_ADDRESS[@]}"
-	do
-		# MPP-15889
-        	CIDR_STANDBY_IP=$(GET_CIDRADDR $STANDBY_IP)
-		CHK_COUNT=`$TRUSTED_SHELL $QE_NAME "$GREP -c \"${CIDR_STANDBY_IP}\" ${QE_BASE_DIR}/$PG_HBA"`
-		if [ $CHK_COUNT -eq 0 ];then
-			LOG_MSG "[INFO][$INST_COUNT]:-Adding standby IP address $QE_NAME ${QE_BASE_DIR}/$PG_HBA file" 1
-			$TRUSTED_SHELL $QE_NAME "$ECHO host  all     all     ${CIDR_STANDBY_IP}       trust >> ${QE_BASE_DIR}/$PG_HBA"
-			if [ $? -ne 0 ];then
-				$ECHO "FAILED:${QE_LINE}:ADD_IP" >> $PARALLEL_STATUS_FILE
-				ERROR_EXIT "Failed to add standby IP address $QE_NAME ${QE_BASE_DIR}/$PG_HBA file" 2
-			else
-				LOG_MSG "[INFO][$INST_COUNT]:-Added standby IP address $QE_NAME ${QE_BASE_DIR}/$PG_HBA file" 1
-			fi
-		else
-			LOG_MSG "[INFO][$INST_COUNT]:-IP address $QE_NAME ${QE_BASE_DIR}/$PG_HBA already there, no update required" 1
-		fi
-	done
-	LOG_MSG "[INFO][$INST_COUNT]:-End Function $FUNCNAME"
-}
-#******************************************************************************
-# Main Section
-#******************************************************************************
-trap '$ECHO "KILLED:${QE_NAME}:${QE_BASE_DIR}" >> $PARALLEL_STATUS_FILE;ERROR_EXIT "[FATAL]:-[$INST_COUNT]-Recieved INT or TERM signal" 2' INT TERM
-while getopts ":v'?'" opt
-	do
-	case $opt in
-		v ) VERSION_INFO ;;
-		'?' ) USAGE ;;
-		* ) USAGE 
-	esac
-done
-#Now process supplied call parameters
-PARENT_PID=$1;shift		#PID of gpstate process calling this script
-CHK_CALL
-INST_COUNT=$1;shift		#Unique number for this parallel script, starts at 0
-LOG_FILE=$1;shift		#Central utility log file
-QE_NAME=$1;shift
-QE_BASE_DIR=$1;shift
-IP_ADDRESS_LIST=$1;shift
-PARALLEL_STATUS_FILE=$1;shift
-QE_LINE=${QE_NAME}:${QE_BASE_DIR}
-LOG_MSG "[INFO][$INST_COUNT]:-Start Main"
-UPDATE_PGHBA
-$ECHO "COMPLETED:${QE_LINE}" >> $PARALLEL_STATUS_FILE
-LOG_MSG "[INFO][$INST_COUNT]:-End Main"
-exit $EXIT_STATUS

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8ec87e6a/tools/doc/gpactivatestandby_help
----------------------------------------------------------------------
diff --git a/tools/doc/gpactivatestandby_help b/tools/doc/gpactivatestandby_help
deleted file mode 100755
index 923a640..0000000
--- a/tools/doc/gpactivatestandby_help
+++ /dev/null
@@ -1,160 +0,0 @@
-COMMAND NAME: gpactivatestandby
-
-Activates a standby master host and makes it the active master 
-for the Greenplum Database system, or configures a host to be 
-the standby master for a Greenplum Database system.
-
-
-*****************************************************
-SYNOPSIS
-*****************************************************
-
-
-gpactivatestandby -d <standby_master_datadir> [-c <new_standby_master>] 
-[-f] [-a] [-q] [-l <logfile_directory>]  
-
-gpactivatestandby -? | -h | --help 
-
-gpactivatestandby --version
-
-*****************************************************
-DESCRIPTION
-*****************************************************
-
-
-The gpactivatestandby script activates a backup master host and 
-brings it into operation as the active master instance for a Greenplum 
-Database system. The activated standby master effectively becomes the 
-Greenplum Database master, accepting client connections on the master port 
-(which must be set to the same port number on the master host and the 
-backup master host). 
-
-You must run this script from the master host you are 
-activating, not the failed master host you are disabling. Running this 
-script assumes you have a backup master host configured for the system 
-(see gpinitstandby).
-
-The script will perform the following steps:
-
-* Stop the synchronization process (gpsyncmaster) on the backup master
-
-* Update the system catalog tables of the backup master using the logs
-
-* Activate the backup master to be the new active master for the system
-
-* (optional) Make the host specified with the -c option the new standby 
-  master host
-
-* Restart the Greenplum Database system with the new master host
-
-A backup Greenplum master host serves as a warm standby in the event 
-of the primary Greenplum master host becoming unoperational. The backup 
-master is kept up to date by a transaction log replication process 
-(gpsyncmaster), which runs on the backup master host and keeps the 
-data between the primary and backup master hosts synchronized. 
-
-If the primary master fails, the log replication process is shutdown, 
-and the backup master can be activated in its place by using the 
-gpactivatestandby script. Upon activation of the backup master, the 
-replicated logs are used to reconstruct the state of the Greenplum master 
-host at the time of the last successfully committed transaction. To specify 
-a new standby master host after making your current standby 
-master active, use the -c option.
-
-In order to use gpactivatestandby to activate a new primary master host, 
-the master host that was previously serving as the primary master cannot 
-be running. The script checks for a postmaster.pid file in the data 
-directory of the disabled master host, and if it finds it there, it will 
-assume the old master host is still active. In some cases, you may need 
-to remove the postmaster.pid file from the disabled master host data 
-directory before running gpactivatestandby (for example, if the 
-disabled master host process was terminated unexpectedly).
-
-After activating a standby master, run ANALYZE to update the database 
-query statistics. For example:
-
-psql dbname -c 'ANALYZE;'
-
-
-*****************************************************
-OPTIONS
-*****************************************************
-
-
--d <standby_master_datadir>
-
-Required. The absolute path of the data directory for the master host 
-you are activating.
-
-
--c <new_standby_master_hostname>
-
-Optional. After you activate your standby master you may want to specify 
-another host to be the new standby, otherwise your Greenplum Database 
-system will no longer have a standby master configured. Use this option 
-to specify the hostname of the new standby master host. You can also use 
-gpinitstandby at a later time to configure a new standby master host.
-
-
--f (force activation)
-
-Use this option to force activation of the backup master host. 
-Only use this option if you are sure that the backup and primary master 
-hosts are consistent. This option may be useful if you have just 
-initialized a new backup master using gpinitstandby, and want to 
-activate it immediately.
-
-
--a (do not prompt)
-
-Do not prompt the user for confirmation.
-
-
--q (no screen output)
-
-Run in quiet mode. Command output is not displayed on the screen, 
-but is still written to the log file.
-
-
--l <logfile_directory>
-
-The directory to write the log file. Defaults to ~/gpAdminLogs.
-
-
--? | -h | --help
-
-Displays the online help.
-
-
--v (show script version)
-
-Displays the version, status, last updated date, and check sum of this script.
-
-
---version (show utility version)
-
-Displays the version of this utility.
-
-
-*****************************************************
-EXAMPLES
-*****************************************************
-
-
-Activate the backup master host and make it the active master instance for a 
-Greenplum Database system (run from backup master host you are activating):
-
-gpactivatestandby -d /gpdata
-
-
-Activate the backup master host and at the same time configure another 
-host to be your new standby master:
-
-gpactivatestandby -d /gpdata -c new_standby_hostname
-
-
-*****************************************************
-SEE ALSO
-*****************************************************
-
-gpinitsystem, gpinitstandby