You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by ja...@apache.org on 2013/08/29 05:43:38 UTC
[5/7] git commit: DRILL-121 RPM and DEB packages
DRILL-121 RPM and DEB packages
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/2bcf0547
Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/2bcf0547
Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/2bcf0547
Branch: refs/heads/master
Commit: 2bcf0547a0d230e65d8a935c634e01608c19eb5d
Parents: 5232b0e
Author: Steven Phillips <sp...@maprtech.com>
Authored: Wed Aug 21 19:23:28 2013 -0700
Committer: Jacques Nadeau <ja...@apache.org>
Committed: Wed Aug 28 20:37:53 2013 -0700
----------------------------------------------------------------------
sandbox/prototype/distribution/pom.xml | 214 +++++++++++++++++
.../prototype/distribution/src/assemble/bin.xml | 81 +++++++
.../distribution/src/deb/control/conffiles | 3 +
.../distribution/src/deb/control/control | 8 +
.../distribution/src/resources/drill-config.sh | 96 ++++++++
.../distribution/src/resources/drill-env.sh | 2 +
.../src/resources/drill-override.conf | 36 +++
.../distribution/src/resources/drillbit | 166 +++++++++++++
.../distribution/src/resources/drillbit.sh | 230 +++++++++++++++++++
.../distribution/src/resources/logback.xml | 36 +++
.../prototype/distribution/src/resources/runbit | 30 +++
.../distribution/src/resources/sqlline | 30 +++
.../src/main/resources/drill-module.conf | 2 +-
.../java-exec/src/main/resources/logback.xml | 49 ++++
.../exec/java-exec/src/main/sh/drill-config.sh | 96 ++++++++
.../exec/java-exec/src/main/sh/drillbit.sh | 230 +++++++++++++++++++
.../prototype/exec/java-exec/src/main/sh/runbit | 30 +++
sandbox/prototype/pom.xml | 10 +
18 files changed, 1348 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2bcf0547/sandbox/prototype/distribution/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/prototype/distribution/pom.xml b/sandbox/prototype/distribution/pom.xml
new file mode 100644
index 0000000..934c81a
--- /dev/null
+++ b/sandbox/prototype/distribution/pom.xml
@@ -0,0 +1,214 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>prototype-parent</artifactId>
+ <groupId>org.apache.drill</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.drill</groupId>
+ <artifactId>distribution</artifactId>
+ <packaging>pom</packaging>
+ <name>Packaging</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.drill.exec</groupId>
+ <artifactId>java-exec</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.drill.exec</groupId>
+ <artifactId>netty-bufferl</artifactId>
+ <version>4.0.7.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.drill.exec</groupId>
+ <artifactId>ref</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.drill</groupId>
+ <artifactId>common</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.drill</groupId>
+ <artifactId>planner</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.drill</groupId>
+ <artifactId>sqlparser</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distro-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assemble/bin.xml</descriptor>
+ </descriptors>
+ <finalName>drill-1.0</finalName>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>rpm</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>rpm-maven-plugin</artifactId>
+ <version>2.1-alpha-3</version>
+ <executions>
+ <execution>
+ <id>generate-rpm</id>
+ <goals>
+ <goal>rpm</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <copyright>2013 ASF</copyright>
+ <group>Apache Software Foundation</group>
+ <prefix>/opt</prefix>
+ <release>SNAPSHOT</release>
+ <version>1.0</version>
+ <name>drill</name>
+ <mappings>
+ <mapping>
+ <directory>/opt/drill/bin</directory>
+ <sources>
+ <source>
+ <location>target/drill-1.0-bin/drill-1.0/bin</location>
+ </source>
+ </sources>
+ </mapping>
+ <mapping>
+ <directory>/opt/drill/lib</directory>
+ <sources>
+ <source>
+ <location>target/drill-1.0-bin/drill-1.0/lib</location>
+ </source>
+ </sources>
+ </mapping>
+ <mapping>
+ <directory>/opt/drill/jars</directory>
+ <sources>
+ <source>
+ <location>target/drill-1.0-bin/drill-1.0/jars</location>
+ </source>
+ </sources>
+ </mapping>
+ <mapping>
+ <directory>/etc/drill/conf</directory>
+ <sources>
+ <source>
+ <location>target/drill-1.0-bin/drill-1.0/conf</location>
+ </source>
+ </sources>
+ <configuration>true</configuration>
+ </mapping>
+ <mapping>
+ <directory>/etc/init.d/</directory>
+ <sources>
+ <source>
+ <location>src/resources/drillbit</location>
+ </source>
+ </sources>
+ <directoryIncluded>false</directoryIncluded>
+ </mapping>
+ </mappings>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>deb</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>jdeb</artifactId>
+ <groupId>org.vafer</groupId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>jdeb</goal>
+ </goals>
+ <configuration>
+ <deb>target/drill-1.0-SNAPSHOT.deb</deb>
+ <dataSet>
+ <data>
+ <src>target/drill-1.0-bin/drill-1.0/lib</src>
+ <type>directory</type>
+ <mapper>
+ <type>perm</type>
+ <prefix>/opt/drill/lib/</prefix>
+ </mapper>
+ </data>
+ <data>
+ <src>target/drill-1.0-bin/drill-1.0/jars</src>
+ <type>directory</type>
+ <mapper>
+ <type>perm</type>
+ <prefix>/opt/drill/jars/</prefix>
+ </mapper>
+ </data>
+ <data>
+ <src>target/drill-1.0-bin/drill-1.0/bin</src>
+ <type>directory</type>
+ <mapper>
+ <type>perm</type>
+ <prefix>/opt/drill/bin/</prefix>
+ <filemode>755</filemode>
+ </mapper>
+ </data>
+ <data>
+ <src>target/drill-1.0-bin/drill-1.0/conf</src>
+ <type>directory</type>
+ <mapper>
+ <type>perm</type>
+ <prefix>/etc/drill/conf</prefix>
+ <filemode>755</filemode>
+ </mapper>
+ </data>
+ <data>
+ <src>src/resources/drillbit</src>
+ <dst>/etc/init.d/drillbit</dst>
+ <type>file</type>
+ <mapper>
+ <type>perm</type>
+ <filemode>755</filemode>
+ </mapper>
+ </data>
+ </dataSet>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2bcf0547/sandbox/prototype/distribution/src/assemble/bin.xml
----------------------------------------------------------------------
diff --git a/sandbox/prototype/distribution/src/assemble/bin.xml b/sandbox/prototype/distribution/src/assemble/bin.xml
new file mode 100644
index 0000000..5276c69
--- /dev/null
+++ b/sandbox/prototype/distribution/src/assemble/bin.xml
@@ -0,0 +1,81 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <id>bin</id>
+ <formats>
+ <format>tar.gz</format>
+ <format>dir</format>
+ </formats>
+ <includeBaseDirectory>true</includeBaseDirectory>
+ <moduleSets>
+ <moduleSet>
+
+ <!-- Enable access to all projects in the current multimodule build! -->
+ <useAllReactorProjects>true</useAllReactorProjects>
+
+ <!-- Now, select which projects to include in this module-set. -->
+ <includes>
+ <include>org.apache.drill:planner:jar</include>
+ <include>org.apache.drill:sqlparser:jar</include>
+ <include>org.apache.drill.exec:netty-bufferl</include>
+ <include>org.apache.drill.exec:ref</include>
+ </includes>
+ <binaries>
+ <outputDirectory>jars</outputDirectory>
+ <unpack>false</unpack>
+ </binaries>
+ </moduleSet>
+ </moduleSets>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>lib</outputDirectory>
+ <unpack>false</unpack>
+ <useProjectArtifact>false</useProjectArtifact>
+ <excludes>
+ <exclude>org.apache.drill</exclude>
+ <exclude>org.apache.drill.exec</exclude>
+ <exclude>com.google.protobuf</exclude>
+ <exclude>de.huxhorn.*</exclude>
+ </excludes>
+ <scope>test</scope>
+ </dependencySet>
+ </dependencySets>
+ <files>
+ <file>
+ <source>../common/target/common-1.0-SNAPSHOT-rebuffed.jar</source>
+ <outputDirectory>jars</outputDirectory>
+ </file>
+ <file>
+ <source>../exec/java-exec/target/java-exec-1.0-SNAPSHOT-rebuffed.jar</source>
+ <outputDirectory>jars</outputDirectory>
+ </file>
+ <file>
+ <source>src/resources/runbit</source>
+ <outputDirectory>bin</outputDirectory>
+ </file>
+ <file>
+ <source>src/resources/drillbit.sh</source>
+ <outputDirectory>bin</outputDirectory>
+ </file>
+ <file>
+ <source>src/resources/drill-config.sh</source>
+ <outputDirectory>bin</outputDirectory>
+ </file>
+ <file>
+ <source>src/resources/sqlline</source>
+ <outputDirectory>bin</outputDirectory>
+ </file>
+ <file>
+ <source>src/resources/drill-override.conf</source>
+ <outputDirectory>conf</outputDirectory>
+ </file>
+ <file>
+ <source>src/resources/logback.xml</source>
+ <outputDirectory>conf</outputDirectory>
+ </file>
+ <file>
+ <source>src/resources/drill-env.sh</source>
+ <outputDirectory>conf</outputDirectory>
+ </file>
+ </files>
+</assembly>
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2bcf0547/sandbox/prototype/distribution/src/deb/control/conffiles
----------------------------------------------------------------------
diff --git a/sandbox/prototype/distribution/src/deb/control/conffiles b/sandbox/prototype/distribution/src/deb/control/conffiles
new file mode 100644
index 0000000..a9d1fda
--- /dev/null
+++ b/sandbox/prototype/distribution/src/deb/control/conffiles
@@ -0,0 +1,3 @@
+/etc/drill/conf/drill-override.conf
+/etc/drill/conf/logback.xml
+/etc/drill/conf/drill-env.sh
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2bcf0547/sandbox/prototype/distribution/src/deb/control/control
----------------------------------------------------------------------
diff --git a/sandbox/prototype/distribution/src/deb/control/control b/sandbox/prototype/distribution/src/deb/control/control
new file mode 100644
index 0000000..8a6b69b
--- /dev/null
+++ b/sandbox/prototype/distribution/src/deb/control/control
@@ -0,0 +1,8 @@
+Package: drill
+Version: 1.0-SNAPSHOT
+Section: misc
+Priority: optional
+Architecture: all
+Maintainer: name <>
+Description: Apache Drill
+Distribution: development
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2bcf0547/sandbox/prototype/distribution/src/resources/drill-config.sh
----------------------------------------------------------------------
diff --git a/sandbox/prototype/distribution/src/resources/drill-config.sh b/sandbox/prototype/distribution/src/resources/drill-config.sh
new file mode 100644
index 0000000..20102fc
--- /dev/null
+++ b/sandbox/prototype/distribution/src/resources/drill-config.sh
@@ -0,0 +1,96 @@
+#
+#/**
+# * Copyright 2013 The Apache Software Foundation
+# *
+# * Licensed to the Apache Software Foundation (ASF) under one
+# * or more contributor license agreements. See the NOTICE file
+# * distributed with this work for additional information
+# * regarding copyright ownership. The ASF licenses this file
+# * to you under the Apache License, Version 2.0 (the
+# * "License"); you may not use this file except in compliance
+# * with the License. You may obtain a copy of the License at
+# *
+# * http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# */
+
+# included in all the drill scripts with source command
+# should not be executable directly
+# also should not be passed any arguments, since we need original $*
+# Modelled after $HADOOP_HOME/bin/hadoop-env.sh.
+
+# resolve links - "${BASH_SOURCE-$0}" may be a softlink
+
+this="${BASH_SOURCE-$0}"
+while [ -h "$this" ]; do
+ ls=`ls -ld "$this"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ this="$link"
+ else
+ this=`dirname "$this"`/"$link"
+ fi
+done
+
+# convert relative path to absolute path
+bin=`dirname "$this"`
+script=`basename "$this"`
+bin=`cd "$bin">/dev/null; pwd`
+this="$bin/$script"
+
+# the root of the drill installation
+if [ -z "$DRILL_HOME" ]; then
+ export DRILL_HOME=`dirname "$this"`/..
+fi
+
+#check to see if the conf dir or drill home are given as an optional arguments
+while [ $# -gt 1 ]
+do
+ if [ "--config" = "$1" ]
+ then
+ shift
+ confdir=$1
+ shift
+ DRILL_CONF_DIR=$confdir
+ else
+ # Presume we are at end of options and break
+ break
+ fi
+done
+
+# Allow alternate drill conf dir location.
+export DRILL_CONF_DIR="${DRILL_CONF_DIR:-/etc/drill/conf}"
+
+. "${DRILL_CONF_DIR}/drill-env.sh"
+
+# Newer versions of glibc use an arena memory allocator that causes virtual
+# memory usage to explode. Tune the variable down to prevent vmem explosion.
+export MALLOC_ARENA_MAX=${MALLOC_ARENA_MAX:-4}
+
+if [ -z "$JAVA_HOME" ]; then
+ if [ -e `which java` ]; then
+ SOURCE=`which java`
+ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
+ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+ SOURCE="$(readlink "$SOURCE")"
+ [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
+ done
+ JAVA_HOME="$( cd -P "$( dirname "$SOURCE" )" && cd .. && pwd )"
+ fi
+ # if we didn't set it
+ if [ -z "$JAVA_HOME" ]; then
+ cat 1>&2 <<EOF
++======================================================================+
+| Error: JAVA_HOME is not set and Java could not be found |
++----------------------------------------------------------------------+
+| Drill requires Java 1.7 or later. |
++======================================================================+
+EOF
+ exit 1
+ fi
+fi
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2bcf0547/sandbox/prototype/distribution/src/resources/drill-env.sh
----------------------------------------------------------------------
diff --git a/sandbox/prototype/distribution/src/resources/drill-env.sh b/sandbox/prototype/distribution/src/resources/drill-env.sh
new file mode 100644
index 0000000..8bfb66b
--- /dev/null
+++ b/sandbox/prototype/distribution/src/resources/drill-env.sh
@@ -0,0 +1,2 @@
+DRILL_MAX_DIRECT_MEMORY="8G"
+export DRILL_JAVA_OPTS="-XX:MaxDirectMemorySize=$DRILL_MAX_DIRECT_MEMORY"
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2bcf0547/sandbox/prototype/distribution/src/resources/drill-override.conf
----------------------------------------------------------------------
diff --git a/sandbox/prototype/distribution/src/resources/drill-override.conf b/sandbox/prototype/distribution/src/resources/drill-override.conf
new file mode 100644
index 0000000..30305af
--- /dev/null
+++ b/sandbox/prototype/distribution/src/resources/drill-override.conf
@@ -0,0 +1,36 @@
+// This file tells Drill to consider this module when class path scanning.
+// This file can also include any supplementary configuration information.
+// This file is in HOCON format, see https://github.com/typesafehub/config/blob/master/HOCON.md for more information.
+drill.exec: {
+ cluster-id: "drillbits1"
+ rpc: {
+ user.port : 31010,
+ bit.port : 32011
+ },
+ operator: {
+ packages += "org.apache.drill.exec.physical.config"
+ },
+ optimizer: {
+ implementation: "org.apache.drill.exec.opt.IdentityOptimizer"
+ },
+ storage: {
+ packages += "org.apache.drill.exec.store"
+ }
+ metrics : {
+ context: "drillbit"
+ },
+ zk: {
+ connect: "localhost:2181",
+ root: "/drill",
+ refresh: 500,
+ timeout: 5000,
+ retry: {
+ count: 7200,
+ delay: 500
+ }
+ }
+
+ network: {
+ start: 35000
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2bcf0547/sandbox/prototype/distribution/src/resources/drillbit
----------------------------------------------------------------------
diff --git a/sandbox/prototype/distribution/src/resources/drillbit b/sandbox/prototype/distribution/src/resources/drillbit
new file mode 100755
index 0000000..f235ed3
--- /dev/null
+++ b/sandbox/prototype/distribution/src/resources/drillbit
@@ -0,0 +1,166 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Starts a Drillbit
+#
+# chkconfig: 345 85 15
+# description: Drillbit
+#
+### BEGIN INIT INFO
+# Provides: drillbit
+# Short-Description: Drillbit
+# Default-Start: 3 4 5
+# Default-Stop: 0 1 2 6
+# Required-Start: $syslog $remote_fs
+# Required-Stop: $syslog $remote_fs
+# Should-Start:
+# Should-Stop:
+### END INIT INFO
+
+. /lib/lsb/init-functions
+RETVAL_SUCCESS=0
+
+STATUS_RUNNING=0
+STATUS_DEAD=1
+STATUS_DEAD_AND_LOCK=2
+STATUS_NOT_RUNNING=3
+STATUS_OTHER_ERROR=102
+
+
+ERROR_PROGRAM_NOT_INSTALLED=5
+ERROR_PROGRAM_NOT_CONFIGURED=6
+
+
+RETVAL=0
+SLEEP_TIME=5
+PROC_NAME="java"
+
+DAEMON="drillbit"
+DESC="Drillbit"
+EXEC_PATH="/opt/drill/bin/drillbit.sh"
+SVC_USER=""
+DAEMON_FLAGS=""
+CONF_DIR="/etc/drill/conf"
+PIDFILE="/opt/drill/drillbit.pid"
+LOCKDIR="/var/lock/subsys"
+LOCKFILE="$LOCKDIR/drillbit"
+WORKING_DIR="~/"
+
+install -d -m 0755 -o -g /var/run/drillbit 1>/dev/null 2>&1 || :
+[ -d "$LOCKDIR" ] || install -d -m 0755 $LOCKDIR 1>/dev/null 2>&1 || :
+
+start() {
+ [ -x $EXEC_PATH ] || exit $ERROR_PROGRAM_NOT_INSTALLED
+ [ -d $CONF_DIR ] || exit $ERROR_PROGRAM_NOT_CONFIGURED
+ log_success_msg "Starting ${DESC}: "
+
+ su -s /bin/bash $SVC_USER -c "cd $WORKING_DIR && $EXEC_PATH --config '$CONF_DIR' start $DAEMON_FLAGS"
+
+ # Some processes are slow to start
+ sleep $SLEEP_TIME
+ checkstatusofproc
+ RETVAL=$?
+
+ [ $RETVAL -eq $RETVAL_SUCCESS ] && touch $LOCKFILE
+ return $RETVAL
+}
+
+
+stop() {
+ log_success_msg "Stopping ${DESC}: "
+ start_daemon $EXEC_PATH --config "$CONF_DIR" stop $DAEMON_FLAGS
+ RETVAL=$?
+
+ [ $RETVAL -eq $RETVAL_SUCCESS ] && rm -f $LOCKFILE $PIDFILE
+}
+
+restart() {
+ stop
+ start
+}
+
+checkstatusofproc(){
+ pidofproc -p $PIDFILE $PROC_NAME > /dev/null
+}
+
+checkstatus(){
+ checkstatusofproc
+ status=$?
+
+ case "$status" in
+ $STATUS_RUNNING)
+ log_success_msg "${DESC} is running"
+ ;;
+ $STATUS_DEAD)
+ log_failure_msg "${DESC} is dead and pid file exists"
+ ;;
+ $STATUS_DEAD_AND_LOCK)
+ log_failure_msg "${DESC} is dead and lock file exists"
+ ;;
+ $STATUS_NOT_RUNNING)
+ log_failure_msg "${DESC} is not running"
+ ;;
+ *)
+ log_failure_msg "${DESC} status is unknown"
+ ;;
+ esac
+ return $status
+}
+
+condrestart(){
+ [ -e $LOCKFILE ] && restart || :
+}
+
+check_for_root() {
+ if [ $(id -ur) -ne 0 ]; then
+ echo 'Error: root user required'
+ echo
+ exit 1
+ fi
+}
+
+service() {
+ case "$1" in
+ start)
+ check_for_root
+ start
+ ;;
+ stop)
+ check_for_root
+ stop
+ ;;
+ status)
+ checkstatus
+ RETVAL=$?
+ ;;
+ restart)
+ check_for_root
+ restart
+ ;;
+ condrestart|try-restart)
+ check_for_root
+ condrestart
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|try-restart|condrestart}"
+ exit 1
+ esac
+}
+
+service "$1"
+
+exit $RETVAL
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2bcf0547/sandbox/prototype/distribution/src/resources/drillbit.sh
----------------------------------------------------------------------
diff --git a/sandbox/prototype/distribution/src/resources/drillbit.sh b/sandbox/prototype/distribution/src/resources/drillbit.sh
new file mode 100755
index 0000000..f5293a6
--- /dev/null
+++ b/sandbox/prototype/distribution/src/resources/drillbit.sh
@@ -0,0 +1,230 @@
+#!/usr/bin/env bash
+#
+#/**
+# * Copyright 2013 The Apache Software Foundation
+# *
+# * Licensed to the Apache Software Foundation (ASF) under one
+# * or more contributor license agreements. See the NOTICE file
+# * distributed with this work for additional information
+# * regarding copyright ownership. The ASF licenses this file
+# * to you under the Apache License, Version 2.0 (the
+# * "License"); you may not use this file except in compliance
+# * with the License. You may obtain a copy of the License at
+# *
+# * http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# */
+#
+# Environment Variables
+#
+# DRILL_CONF_DIR Alternate drill conf dir. Default is ${DRILL_HOME}/conf.
+# DRILL_LOG_DIR Where log files are stored. PWD by default.
+# DRILL_PID_DIR The pid files are stored. /tmp by default.
+# DRILL_IDENT_STRING A string representing this instance of drillbit. $USER by default
+# DRILL_NICENESS The scheduling priority for daemons. Defaults to 0.
+# DRILL_STOP_TIMEOUT Time, in seconds, after which we kill -9 the server if it has not stopped.
+# Default 1200 seconds.
+#
+# Modelled after $HADOOP_HOME/bin/hadoop-daemon.sh
+
+usage="Usage: drillbit.sh [--config <conf-dir>]\
+ (start|stop|restart|autorestart)"
+
+# if no args specified, show usage
+if [ $# -lt 1 ]; then
+ echo $usage
+ exit 1
+fi
+
+bin=`dirname "${BASH_SOURCE-$0}"`
+bin=`cd "$bin">/dev/null; pwd`
+
+. "$bin"/drill-config.sh
+
+# get arguments
+startStop=$1
+shift
+
+command=drillbit
+shift
+
+waitForProcessEnd() {
+ pidKilled=$1
+ commandName=$2
+ processedAt=`date +%s`
+ while kill -0 $pidKilled > /dev/null 2>&1;
+ do
+ echo -n "."
+ sleep 1;
+ # if process persists more than $DRILL_STOP_TIMEOUT (default 1200 sec) no mercy
+ if [ $(( `date +%s` - $processedAt )) -gt ${DRILL_STOP_TIMEOUT:-1200} ]; then
+ break;
+ fi
+ done
+ # process still there : kill -9
+ if kill -0 $pidKilled > /dev/null 2>&1; then
+ echo -n force stopping $commandName with kill -9 $pidKilled
+ $JAVA_HOME/bin/jstack -l $pidKilled > "$logout" 2>&1
+ kill -9 $pidKilled > /dev/null 2>&1
+ fi
+ # Add a CR after we're done w/ dots.
+ echo
+}
+
+drill_rotate_log ()
+{
+ log=$1;
+ num=5;
+ if [ -n "$2" ]; then
+ num=$2
+ fi
+ if [ -f "$log" ]; then # rotate logs
+ while [ $num -gt 1 ]; do
+ prev=`expr $num - 1`
+ [ -f "$log.$prev" ] && mv -f "$log.$prev" "$log.$num"
+ num=$prev
+ done
+ mv -f "$log" "$log.$num";
+ fi
+}
+
+check_before_start(){
+ #ckeck if the process is not running
+ mkdir -p "$DRILL_PID_DIR"
+ if [ -f $pid ]; then
+ if kill -0 `cat $pid` > /dev/null 2>&1; then
+ echo $command running as process `cat $pid`. Stop it first.
+ exit 1
+ fi
+ fi
+}
+
+wait_until_done ()
+{
+ p=$1
+ cnt=${DRILLBIT_TIMEOUT:-300}
+ origcnt=$cnt
+ while kill -0 $p > /dev/null 2>&1; do
+ if [ $cnt -gt 1 ]; then
+ cnt=`expr $cnt - 1`
+ sleep 1
+ else
+ echo "Process did not complete after $origcnt seconds, killing."
+ kill -9 $p
+ exit 1
+ fi
+ done
+ return 0
+}
+
+# get log directory
+if [ "$DRILL_LOG_DIR" = "" ]; then
+ export DRILL_LOG_DIR=/var/log/drill
+fi
+mkdir -p "$DRILL_LOG_DIR"
+
+if [ "$DRILL_PID_DIR" = "" ]; then
+ DRILL_PID_DIR=$DRILL_HOME
+fi
+
+# Some variables
+# Work out java location so can print version into log.
+if [ "$JAVA_HOME" != "" ]; then
+ #echo "run java in $JAVA_HOME"
+ JAVA_HOME=$JAVA_HOME
+fi
+if [ "$JAVA_HOME" = "" ]; then
+ echo "Error: JAVA_HOME is not set."
+ exit 1
+fi
+
+JAVA=$JAVA_HOME/bin/java
+export DRILL_LOG_PREFIX=drillbit
+export DRILL_LOGFILE=$DRILL_LOG_PREFIX.log
+export DRILL_OUTFILE=$DRILL_LOG_PREFIX.out
+loggc=$DRILL_LOG_DIR/$DRILL_LOG_PREFIX.gc
+loglog="${DRILL_LOG_DIR}/${DRILL_LOGFILE}"
+logout="${DRILL_LOG_DIR}/${DRILL_OUTFILE}"
+pid=$DRILL_PID_DIR/drillbit.pid
+
+DRILL_JAVA_OPTS="$DRILL_JAVA_OPTS -Dlog.path=$loglog"
+
+if [ -n "$SERVER_GC_OPTS" ]; then
+ export SERVER_GC_OPTS=${SERVER_GC_OPTS/"-Xloggc:<FILE-PATH>"/"-Xloggc:${loggc}"}
+fi
+if [ -n "$CLIENT_GC_OPTS" ]; then
+ export CLIENT_GC_OPTS=${CLIENT_GC_OPTS/"-Xloggc:<FILE-PATH>"/"-Xloggc:${loggc}"}
+fi
+
+# Set default scheduling priority
+if [ "$DRILL_NICENESS" = "" ]; then
+ export DRILL_NICENESS=0
+fi
+
+thiscmd=$0
+args=$@
+
+case $startStop in
+
+(start)
+ check_before_start
+ echo starting $command, logging to $logout
+ nohup $thiscmd internal_start $command $args < /dev/null >> ${logout} 2>&1 &
+ sleep 1;
+ ;;
+
+(internal_start)
+ drill_rotate_log $loggc
+ # Add to the command log file vital stats on our environment.
+ echo "`date` Starting $command on `hostname`" >> $loglog
+ echo "`ulimit -a`" >> $loglog 2>&1
+ nice -n $DRILL_NICENESS "$DRILL_HOME"/bin/runbit \
+ $command "$@" start >> "$logout" 2>&1 &
+ echo $! > $pid
+ wait
+ ;;
+
+(stop)
+ rm -f "$DRILL_START_FILE"
+ if [ -f $pid ]; then
+ pidToKill=`cat $pid`
+ # kill -0 == see if the PID exists
+ if kill -0 $pidToKill > /dev/null 2>&1; then
+ echo stopping $command
+ echo "`date` Terminating $command" pid $pidToKill>> $loglog
+ kill $pidToKill > /dev/null 2>&1
+ waitForProcessEnd $pidToKill $command
+ rm $pid
+ else
+ retval=$?
+ echo no $command to stop because kill -0 of pid $pidToKill failed with status $retval
+ fi
+ else
+ echo no $command to stop because no pid file $pid
+ fi
+ ;;
+
+(restart)
+ # stop the command
+ $thiscmd --config "${DRILL_CONF_DIR}" stop $command $args &
+ wait_until_done $!
+ # wait a user-specified sleep period
+ sp=${DRILL_RESTART_SLEEP:-3}
+ if [ $sp -gt 0 ]; then
+ sleep $sp
+ fi
+ # start the command
+ $thiscmd --config "${DRILL_CONF_DIR}" start $command $args &
+ wait_until_done $!
+ ;;
+
+(*)
+ echo $usage
+ exit 1
+ ;;
+esac
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2bcf0547/sandbox/prototype/distribution/src/resources/logback.xml
----------------------------------------------------------------------
diff --git a/sandbox/prototype/distribution/src/resources/logback.xml b/sandbox/prototype/distribution/src/resources/logback.xml
new file mode 100644
index 0000000..8f0d410
--- /dev/null
+++ b/sandbox/prototype/distribution/src/resources/logback.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<configuration>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+ </pattern>
+ </encoder>
+ </appender>
+
+ <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.path}</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.path}.%i</fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>100MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <logger name="org.apache.drill" additivity="false">
+ <level value="info" />
+ <appender-ref ref="FILE" />
+ </logger>
+
+ <root>
+ <level value="error" />
+ <appender-ref ref="STDOUT" />
+ </root>
+
+</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2bcf0547/sandbox/prototype/distribution/src/resources/runbit
----------------------------------------------------------------------
diff --git a/sandbox/prototype/distribution/src/resources/runbit b/sandbox/prototype/distribution/src/resources/runbit
new file mode 100755
index 0000000..4e1b599
--- /dev/null
+++ b/sandbox/prototype/distribution/src/resources/runbit
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+
+if [ -z $JAVA_HOME ]
+then
+ JAVA=`which java`
+else
+ JAVA=$JAVA_HOME/bin/java
+fi
+
+if [ -e $JAVA ]; then
+ echo ""
+else
+ echo "Java not found."
+ exit 1
+fi
+
+$JAVA -version 2>&1 | grep "version" | egrep -e "1.7" > /dev/null
+if [ $? -ne 0 ]; then
+ echo "Java 1.7 is required to run Apache Drill."
+ exit 1
+fi
+
+
+CP=$DRILL_HOME/jars/*:$CP
+CP=$DRILL_HOME/lib/*:$CP
+
+CP=$CP:$DRILL_CONF_DIR
+
+exec $JAVA $DRILL_JAVA_OPTS -cp $CP org.apache.drill.exec.server.Drillbit
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2bcf0547/sandbox/prototype/distribution/src/resources/sqlline
----------------------------------------------------------------------
diff --git a/sandbox/prototype/distribution/src/resources/sqlline b/sandbox/prototype/distribution/src/resources/sqlline
new file mode 100755
index 0000000..973da49
--- /dev/null
+++ b/sandbox/prototype/distribution/src/resources/sqlline
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+
+if [ -z $JAVA_HOME ]
+then
+ JAVA=`which java`
+else
+ JAVA=$JAVA_HOME/bin/java
+fi
+
+if [ -e $JAVA ]; then
+ echo ""
+else
+ echo "Java not found."
+ exit 1
+fi
+
+$JAVA -version 2>&1 | grep "version" | egrep -e "1.7" > /dev/null
+if [ $? -ne 0 ]; then
+ echo "Java 1.7 is required to run Apache Drill."
+ exit 1
+fi
+
+
+CP=$DRILL_HOME/jars/*:$CP
+CP=$DRILL_HOME/lib/*:$CP
+
+CP=$CP:$DRILL_CONF_DIR
+
+exec $DRILL_JAVA_OPTS -cp $CP sqlline.SqlLine "$@"
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2bcf0547/sandbox/prototype/exec/java-exec/src/main/resources/drill-module.conf
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/src/main/resources/drill-module.conf b/sandbox/prototype/exec/java-exec/src/main/resources/drill-module.conf
index a590420..d9e1ef5 100644
--- a/sandbox/prototype/exec/java-exec/src/main/resources/drill-module.conf
+++ b/sandbox/prototype/exec/java-exec/src/main/resources/drill-module.conf
@@ -16,7 +16,7 @@ drill.exec: {
},
zk: {
- connect: "10.10.30.52:5181",
+ connect: "localhost:2181",
root: "/drill",
refresh: 500,
timeout: 5000,
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2bcf0547/sandbox/prototype/exec/java-exec/src/main/resources/logback.xml
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/src/main/resources/logback.xml b/sandbox/prototype/exec/java-exec/src/main/resources/logback.xml
new file mode 100644
index 0000000..feb75b3
--- /dev/null
+++ b/sandbox/prototype/exec/java-exec/src/main/resources/logback.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<configuration>
+ <appender name="SOCKET"
+ class="de.huxhorn.lilith.logback.appender.ClassicMultiplexSocketAppender">
+ <Compressing>true</Compressing>
+ <ReconnectionDelay>10000</ReconnectionDelay>
+ <IncludeCallerData>true</IncludeCallerData>
+ <RemoteHosts>localhost</RemoteHosts>
+ </appender>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+ </pattern>
+ </encoder>
+ </appender>
+
+ <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.path}</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.path}.%i</fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>100MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <logger name="org.apache.drill" additivity="false">
+ <level value="info" />
+ <appender-ref ref="FILE" />
+ </logger>
+
+ <logger name="org.apache.drill" additivity="false">
+ <level value="debug" />
+ <appender-ref ref="SOCKET" />
+ </logger>
+
+ <root>
+ <level value="error" />
+ <appender-ref ref="STDOUT" />
+ </root>
+
+</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2bcf0547/sandbox/prototype/exec/java-exec/src/main/sh/drill-config.sh
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/src/main/sh/drill-config.sh b/sandbox/prototype/exec/java-exec/src/main/sh/drill-config.sh
new file mode 100644
index 0000000..20102fc
--- /dev/null
+++ b/sandbox/prototype/exec/java-exec/src/main/sh/drill-config.sh
@@ -0,0 +1,96 @@
+#
+#/**
+# * Copyright 2013 The Apache Software Foundation
+# *
+# * Licensed to the Apache Software Foundation (ASF) under one
+# * or more contributor license agreements. See the NOTICE file
+# * distributed with this work for additional information
+# * regarding copyright ownership. The ASF licenses this file
+# * to you under the Apache License, Version 2.0 (the
+# * "License"); you may not use this file except in compliance
+# * with the License. You may obtain a copy of the License at
+# *
+# * http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# */
+
+# included in all the drill scripts with source command
+# should not be executable directly
+# also should not be passed any arguments, since we need original $*
+# Modelled after $HADOOP_HOME/bin/hadoop-env.sh.
+
+# resolve links - "${BASH_SOURCE-$0}" may be a softlink
+
+this="${BASH_SOURCE-$0}"
+while [ -h "$this" ]; do
+ ls=`ls -ld "$this"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ this="$link"
+ else
+ this=`dirname "$this"`/"$link"
+ fi
+done
+
+# convert relative path to absolute path
+bin=`dirname "$this"`
+script=`basename "$this"`
+bin=`cd "$bin">/dev/null; pwd`
+this="$bin/$script"
+
+# the root of the drill installation
+if [ -z "$DRILL_HOME" ]; then
+ export DRILL_HOME=`dirname "$this"`/..
+fi
+
+#check to see if the conf dir or drill home are given as an optional arguments
+while [ $# -gt 1 ]
+do
+ if [ "--config" = "$1" ]
+ then
+ shift
+ confdir=$1
+ shift
+ DRILL_CONF_DIR=$confdir
+ else
+ # Presume we are at end of options and break
+ break
+ fi
+done
+
+# Allow alternate drill conf dir location.
+export DRILL_CONF_DIR="${DRILL_CONF_DIR:-/etc/drill/conf}"
+
+. "${DRILL_CONF_DIR}/drill-env.sh"
+
+# Newer versions of glibc use an arena memory allocator that causes virtual
+# memory usage to explode. Tune the variable down to prevent vmem explosion.
+export MALLOC_ARENA_MAX=${MALLOC_ARENA_MAX:-4}
+
+if [ -z "$JAVA_HOME" ]; then
+ if [ -e `which java` ]; then
+ SOURCE=`which java`
+ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
+ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+ SOURCE="$(readlink "$SOURCE")"
+ [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
+ done
+ JAVA_HOME="$( cd -P "$( dirname "$SOURCE" )" && cd .. && pwd )"
+ fi
+ # if we didn't set it
+ if [ -z "$JAVA_HOME" ]; then
+ cat 1>&2 <<EOF
++======================================================================+
+| Error: JAVA_HOME is not set and Java could not be found |
++----------------------------------------------------------------------+
+| Drill requires Java 1.7 or later. |
++======================================================================+
+EOF
+ exit 1
+ fi
+fi
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2bcf0547/sandbox/prototype/exec/java-exec/src/main/sh/drillbit.sh
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/src/main/sh/drillbit.sh b/sandbox/prototype/exec/java-exec/src/main/sh/drillbit.sh
new file mode 100755
index 0000000..f5293a6
--- /dev/null
+++ b/sandbox/prototype/exec/java-exec/src/main/sh/drillbit.sh
@@ -0,0 +1,230 @@
+#!/usr/bin/env bash
+#
+#/**
+# * Copyright 2013 The Apache Software Foundation
+# *
+# * Licensed to the Apache Software Foundation (ASF) under one
+# * or more contributor license agreements. See the NOTICE file
+# * distributed with this work for additional information
+# * regarding copyright ownership. The ASF licenses this file
+# * to you under the Apache License, Version 2.0 (the
+# * "License"); you may not use this file except in compliance
+# * with the License. You may obtain a copy of the License at
+# *
+# * http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# */
+#
+# Environment Variables
+#
+# DRILL_CONF_DIR Alternate drill conf dir. Default is ${DRILL_HOME}/conf.
+# DRILL_LOG_DIR Where log files are stored. PWD by default.
+# DRILL_PID_DIR The pid files are stored. /tmp by default.
+# DRILL_IDENT_STRING A string representing this instance of drillbit. $USER by default
+# DRILL_NICENESS The scheduling priority for daemons. Defaults to 0.
+# DRILL_STOP_TIMEOUT Time, in seconds, after which we kill -9 the server if it has not stopped.
+# Default 1200 seconds.
+#
+# Modelled after $HADOOP_HOME/bin/hadoop-daemon.sh
+
+usage="Usage: drillbit.sh [--config <conf-dir>]\
+ (start|stop|restart|autorestart)"
+
+# if no args specified, show usage
+if [ $# -lt 1 ]; then
+ echo $usage
+ exit 1
+fi
+
+bin=`dirname "${BASH_SOURCE-$0}"`
+bin=`cd "$bin">/dev/null; pwd`
+
+. "$bin"/drill-config.sh
+
+# get arguments
+startStop=$1
+shift
+
+command=drillbit
+shift
+
+waitForProcessEnd() {
+ pidKilled=$1
+ commandName=$2
+ processedAt=`date +%s`
+ while kill -0 $pidKilled > /dev/null 2>&1;
+ do
+ echo -n "."
+ sleep 1;
+ # if process persists more than $DRILL_STOP_TIMEOUT (default 1200 sec) no mercy
+ if [ $(( `date +%s` - $processedAt )) -gt ${DRILL_STOP_TIMEOUT:-1200} ]; then
+ break;
+ fi
+ done
+ # process still there : kill -9
+ if kill -0 $pidKilled > /dev/null 2>&1; then
+ echo -n force stopping $commandName with kill -9 $pidKilled
+ $JAVA_HOME/bin/jstack -l $pidKilled > "$logout" 2>&1
+ kill -9 $pidKilled > /dev/null 2>&1
+ fi
+ # Add a CR after we're done w/ dots.
+ echo
+}
+
+drill_rotate_log ()
+{
+ log=$1;
+ num=5;
+ if [ -n "$2" ]; then
+ num=$2
+ fi
+ if [ -f "$log" ]; then # rotate logs
+ while [ $num -gt 1 ]; do
+ prev=`expr $num - 1`
+ [ -f "$log.$prev" ] && mv -f "$log.$prev" "$log.$num"
+ num=$prev
+ done
+ mv -f "$log" "$log.$num";
+ fi
+}
+
+check_before_start(){
+ #ckeck if the process is not running
+ mkdir -p "$DRILL_PID_DIR"
+ if [ -f $pid ]; then
+ if kill -0 `cat $pid` > /dev/null 2>&1; then
+ echo $command running as process `cat $pid`. Stop it first.
+ exit 1
+ fi
+ fi
+}
+
+wait_until_done ()
+{
+ p=$1
+ cnt=${DRILLBIT_TIMEOUT:-300}
+ origcnt=$cnt
+ while kill -0 $p > /dev/null 2>&1; do
+ if [ $cnt -gt 1 ]; then
+ cnt=`expr $cnt - 1`
+ sleep 1
+ else
+ echo "Process did not complete after $origcnt seconds, killing."
+ kill -9 $p
+ exit 1
+ fi
+ done
+ return 0
+}
+
+# get log directory
+if [ "$DRILL_LOG_DIR" = "" ]; then
+ export DRILL_LOG_DIR=/var/log/drill
+fi
+mkdir -p "$DRILL_LOG_DIR"
+
+if [ "$DRILL_PID_DIR" = "" ]; then
+ DRILL_PID_DIR=$DRILL_HOME
+fi
+
+# Some variables
+# Work out java location so can print version into log.
+if [ "$JAVA_HOME" != "" ]; then
+ #echo "run java in $JAVA_HOME"
+ JAVA_HOME=$JAVA_HOME
+fi
+if [ "$JAVA_HOME" = "" ]; then
+ echo "Error: JAVA_HOME is not set."
+ exit 1
+fi
+
+JAVA=$JAVA_HOME/bin/java
+export DRILL_LOG_PREFIX=drillbit
+export DRILL_LOGFILE=$DRILL_LOG_PREFIX.log
+export DRILL_OUTFILE=$DRILL_LOG_PREFIX.out
+loggc=$DRILL_LOG_DIR/$DRILL_LOG_PREFIX.gc
+loglog="${DRILL_LOG_DIR}/${DRILL_LOGFILE}"
+logout="${DRILL_LOG_DIR}/${DRILL_OUTFILE}"
+pid=$DRILL_PID_DIR/drillbit.pid
+
+DRILL_JAVA_OPTS="$DRILL_JAVA_OPTS -Dlog.path=$loglog"
+
+if [ -n "$SERVER_GC_OPTS" ]; then
+ export SERVER_GC_OPTS=${SERVER_GC_OPTS/"-Xloggc:<FILE-PATH>"/"-Xloggc:${loggc}"}
+fi
+if [ -n "$CLIENT_GC_OPTS" ]; then
+ export CLIENT_GC_OPTS=${CLIENT_GC_OPTS/"-Xloggc:<FILE-PATH>"/"-Xloggc:${loggc}"}
+fi
+
+# Set default scheduling priority
+if [ "$DRILL_NICENESS" = "" ]; then
+ export DRILL_NICENESS=0
+fi
+
+thiscmd=$0
+args=$@
+
+case $startStop in
+
+(start)
+ check_before_start
+ echo starting $command, logging to $logout
+ nohup $thiscmd internal_start $command $args < /dev/null >> ${logout} 2>&1 &
+ sleep 1;
+ ;;
+
+(internal_start)
+ drill_rotate_log $loggc
+ # Add to the command log file vital stats on our environment.
+ echo "`date` Starting $command on `hostname`" >> $loglog
+ echo "`ulimit -a`" >> $loglog 2>&1
+ nice -n $DRILL_NICENESS "$DRILL_HOME"/bin/runbit \
+ $command "$@" start >> "$logout" 2>&1 &
+ echo $! > $pid
+ wait
+ ;;
+
+(stop)
+ rm -f "$DRILL_START_FILE"
+ if [ -f $pid ]; then
+ pidToKill=`cat $pid`
+ # kill -0 == see if the PID exists
+ if kill -0 $pidToKill > /dev/null 2>&1; then
+ echo stopping $command
+ echo "`date` Terminating $command" pid $pidToKill>> $loglog
+ kill $pidToKill > /dev/null 2>&1
+ waitForProcessEnd $pidToKill $command
+ rm $pid
+ else
+ retval=$?
+ echo no $command to stop because kill -0 of pid $pidToKill failed with status $retval
+ fi
+ else
+ echo no $command to stop because no pid file $pid
+ fi
+ ;;
+
+(restart)
+ # stop the command
+ $thiscmd --config "${DRILL_CONF_DIR}" stop $command $args &
+ wait_until_done $!
+ # wait a user-specified sleep period
+ sp=${DRILL_RESTART_SLEEP:-3}
+ if [ $sp -gt 0 ]; then
+ sleep $sp
+ fi
+ # start the command
+ $thiscmd --config "${DRILL_CONF_DIR}" start $command $args &
+ wait_until_done $!
+ ;;
+
+(*)
+ echo $usage
+ exit 1
+ ;;
+esac
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2bcf0547/sandbox/prototype/exec/java-exec/src/main/sh/runbit
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/src/main/sh/runbit b/sandbox/prototype/exec/java-exec/src/main/sh/runbit
new file mode 100755
index 0000000..4e1b599
--- /dev/null
+++ b/sandbox/prototype/exec/java-exec/src/main/sh/runbit
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+
+if [ -z $JAVA_HOME ]
+then
+ JAVA=`which java`
+else
+ JAVA=$JAVA_HOME/bin/java
+fi
+
+if [ -e $JAVA ]; then
+ echo ""
+else
+ echo "Java not found."
+ exit 1
+fi
+
+$JAVA -version 2>&1 | grep "version" | egrep -e "1.7" > /dev/null
+if [ $? -ne 0 ]; then
+ echo "Java 1.7 is required to run Apache Drill."
+ exit 1
+fi
+
+
+CP=$DRILL_HOME/jars/*:$CP
+CP=$DRILL_HOME/lib/*:$CP
+
+CP=$CP:$DRILL_CONF_DIR
+
+exec $JAVA $DRILL_JAVA_OPTS -cp $CP org.apache.drill.exec.server.Drillbit
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2bcf0547/sandbox/prototype/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/prototype/pom.xml b/sandbox/prototype/pom.xml
index 76bdf24..dcc49a5 100644
--- a/sandbox/prototype/pom.xml
+++ b/sandbox/prototype/pom.xml
@@ -215,6 +215,15 @@
</lifecycleMappingMetadata>
</configuration>
</plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assemble/bin.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
</plugins>
</pluginManagement>
</build>
@@ -292,5 +301,6 @@
<module>exec</module>
<module>planner</module>
<module>sqlparser</module>
+ <module>distribution</module>
</modules>
</project>