Author: vines Date: Wed Dec 5 21:55:08 2012 New Revision: 1417662 URL: http://svn.apache.org/viewvc?rev=1417662&view=rev Log: Accumulo-792 - missed some things
Added: accumulo/branches/1.4/src/assemble/scripts/init.d/ accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-gc (with props) accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-master (with props) accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-monitor (with props) accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-slave (with props) accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-tracer (with props) accumulo/branches/1.4/src/assemble/scripts/slave-only-init.sh (with props) Added: accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-gc URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-gc?rev=1417662&view=auto ============================================================================== --- accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-gc (added) +++ accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-gc Wed Dec 5 21:55:08 2012 @@ -0,0 +1,159 @@ +#! /bin/sh +# chkconfig: 2345 21 20 +### BEGIN INIT INFO +# Provides: accumulo-gc +# Required-Start: $network $local_fs +# Required-Stop: $network $local_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: accumulo garbage collector process +# Description: The accumulo garbage collector handles cleanup of old walogs and files in hdfs +### END INIT INFO + +# 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. + +# Do NOT "set -e" +install -d -m 0775 -o root -g accumulo /var/run/accumulo + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/accumulo/bin +DESC="Accumulo Garbage Collector" +NAME=accumulo-gc +ACCUMULO_PROC=gc +DAEMON=/usr/lib/accumulo/bin/start-server.sh +IP=`ifconfig | grep inet[^6] | awk '{print $2}' | sed 's/addr://' | grep -v 0.0.0.0 | grep -v 127.0.0.1 | head -n 1` +DAEMON_ARGS="$IP gc \"garbage collector\"" +PIDFILE=/var/run/accumulo/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Read configuration variable file if it is present +[ -r /etc/default/accumulo ] && . /etc/default/accumulo + +# Load the VERBOSE setting and other rcS variables +if [ -f /lib/init/vars.sh ]; then + . /lib/init/vars.sh +else + log_daemon_msg() { logger "$@"; } + log_end_msg() { [ $1 -eq 0 ] && RES=OK; logger ${RES:=FAIL}; } +fi + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.2-14) to ensure that this file is present +# and status_of_proc is working. +. /lib/lsb/init-functions + +# +# Function that starts the daemon/service +# +do_start() { + TARGET_USER_NAME="ACCUMULO_USER" + TARGET_USER=$(eval "echo \$$TARGET_USER_NAME") + + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + + if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi + + su -s /bin/sh $TARGET_USER -c "$DAEMON $DAEMON_ARGS > /dev/null || return 1" + + if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 0; fi + return 2 + # Add code here, if necessary, that waits for the process to be ready + # to handle requests from services started subsequently which depend + # on this one. As a last resort, sleep for some time. +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + + if [ ! "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi + + jps -m | grep $ACCUMULO_PROC | awk '{print $1}' | xargs kill -9 + + if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 2; fi + + return 0; +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + #reload|force-reload) + # + # If do_reload() is not implemented then leave this commented out + # and leave 'force-reload' as an alias for 'restart'. + # + #log_daemon_msg "Reloading $DESC" "$NAME" + #do_reload + #log_end_msg $? + #;; + restart|force-reload) + # + # If the "reload" option is implemented then remove the + # 'force-reload' alias + # + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: Propchange: accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-gc ------------------------------------------------------------------------------ svn:executable = * Added: accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-master URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-master?rev=1417662&view=auto ============================================================================== --- accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-master (added) +++ accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-master Wed Dec 5 21:55:08 2012 @@ -0,0 +1,160 @@ +#! /bin/sh +# chkconfig: 2345 21 19 +### BEGIN INIT INFO +# Provides: accumulo-master +# Required-Start: $network $local_fs hadoop-namenode zookeeper-server +# Required-Stop: $network $local_fs accumulo-slave +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: accumulo master process +# Description: The accumulo master manages tablet assignment and balance to accumulo +### END INIT INFO + +# 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. + +# Do NOT "set -e" +install -d -m 0775 -o root -g accumulo /var/run/accumulo + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/accumulo/bin +DESC="Accumulo Master" +NAME=accumulo-master +ACCUMULO_PROC=master +DAEMON=/usr/lib/accumulo/bin/start-server.sh +IP=`ifconfig | grep inet[^6] | awk '{print $2}' | sed 's/addr://' | grep -v 0.0.0.0 | grep -v 127.0.0.1 | head -n 1` +DAEMON_ARGS="$IP master" +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Read configuration variable file if it is present +[ -r /etc/default/accumulo ] && . /etc/default/accumulo + +# Load the VERBOSE setting and other rcS variables +if [ -f /lib/init/vars.sh ]; then + . /lib/init/vars.sh +else + log_daemon_msg() { logger "$@"; } + log_end_msg() { [ $1 -eq 0 ] && RES=OK; logger ${RES:=FAIL}; } +fi + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.2-14) to ensure that this file is present +# and status_of_proc is working. +. /lib/lsb/init-functions + +# +# Function that starts the daemon/service +# +do_start() +{ + TARGET_USER_NAME="ACCUMULO_USER" + TARGET_USER=$(eval "echo \$$TARGET_USER_NAME") + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + + if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi + + su -s /bin/sh $TARGET_USER -c "/usr/lib/accumulo/bin/accumulo org.apache.accumulo.server.master.state.SetGoalState NORMAL" + su -s /bin/sh $TARGET_USER -c "$DAEMON $DAEMON_ARGS > /dev/null || return 1" + + if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 0; fi + return 2 + # Add code here, if necessary, that waits for the process to be ready + # to handle requests from services started subsequently which depend + # on this one. As a last resort, sleep for some time. +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + + if [ ! "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi + + jps -m | grep $ACCUMULO_PROC | awk '{print $1}' | xargs kill -9 + + if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 2; fi + + return 0; +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + #reload|force-reload) + # + # If do_reload() is not implemented then leave this commented out + # and leave 'force-reload' as an alias for 'restart'. + # + #log_daemon_msg "Reloading $DESC" "$NAME" + #do_reload + #log_end_msg $? + #;; + restart|force-reload) + # + # If the "reload" option is implemented then remove the + # 'force-reload' alias + # + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: Propchange: accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-master ------------------------------------------------------------------------------ svn:executable = * Added: accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-monitor URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-monitor?rev=1417662&view=auto ============================================================================== --- accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-monitor (added) +++ accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-monitor Wed Dec 5 21:55:08 2012 @@ -0,0 +1,159 @@ +#! /bin/sh +# chkconfig: 2345 21 20 +### BEGIN INIT INFO +# Provides: accumulo-monitor +# Required-Start: $network $local_fs +# Required-Stop: $network $local_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: accumulo monitor process on 50095 +# Description: The accumulo monitor provides a convenient mechanism for monitoring accumulo +### END INIT INFO + +# 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. + +# Do NOT "set -e" +install -d -m 0775 -o root -g accumulo /var/run/accumulo + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/accumulo/bin +DESC="Accumulo Monitor" +NAME=accumulo-monitor +ACCUMULO_PROC=monitor +DAEMON=/usr/lib/accumulo/bin/start-server.sh +IP=`ifconfig | grep inet[^6] | awk '{print $2}' | sed 's/addr://' | grep -v 0.0.0.0 | grep -v 127.0.0.1 | head -n 1` +DAEMON_ARGS="$IP monitor" +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Read configuration variable file if it is present +[ -r /etc/default/accumulo ] && . /etc/default/accumulo + +# Load the VERBOSE setting and other rcS variables +if [ -f /lib/init/vars.sh ]; then + . /lib/init/vars.sh +else + log_daemon_msg() { logger "$@"; } + log_end_msg() { [ $1 -eq 0 ] && RES=OK; logger ${RES:=FAIL}; } +fi + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.2-14) to ensure that this file is present +# and status_of_proc is working. +. /lib/lsb/init-functions + +# +# Function that starts the daemon/service +# +do_start() +{ + TARGET_USER_NAME="ACCUMULO_MONITOR_USER" + TARGET_USER=$(eval "echo \$$TARGET_USER_NAME") + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + + if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi + + su -s /bin/sh $TARGET_USER -c "$DAEMON $DAEMON_ARGS > /dev/null || return 1" + + if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 0; fi + return 2 + # Add code here, if necessary, that waits for the process to be ready + # to handle requests from services started subsequently which depend + # on this one. As a last resort, sleep for some time. +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + + if [ ! "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi + + jps -m | grep $ACCUMULO_PROC | awk '{print $1}' | xargs kill -9 + + if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 2; fi + + return 0; +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + #reload|force-reload) + # + # If do_reload() is not implemented then leave this commented out + # and leave 'force-reload' as an alias for 'restart'. + # + #log_daemon_msg "Reloading $DESC" "$NAME" + #do_reload + #log_end_msg $? + #;; + restart|force-reload) + # + # If the "reload" option is implemented then remove the + # 'force-reload' alias + # + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: Propchange: accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-monitor ------------------------------------------------------------------------------ svn:executable = * Added: accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-slave URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-slave?rev=1417662&view=auto ============================================================================== --- accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-slave (added) +++ accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-slave Wed Dec 5 21:55:08 2012 @@ -0,0 +1,164 @@ +#! /bin/sh +# chkconfig: 2345 21 15 +### BEGIN INIT INFO +# Provides: accumulo-slave +# Required-Start: $network $local_fs hadoop-namenode hadoop-datanode zookeeper-server accumulo-master +# Required-Stop: $network $local_fs hadoop-datanode hadoop-namenode zookeeper-server accumulo-master +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: accumulo tserver and logger processes +# Description: The accumulo slaves bundle the tserver and logger processes for accumulo +### END INIT INFO + +# 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. + +# Do NOT "set -e" +install -d -m 0775 -o root -g accumulo /var/run/accumulo + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/accumulo/bin +DESC="Accumulo Slave" +NAME=accumulo-slave +ACCUMULO_PROC1=tserver +ACCUMULO_PROC2=logger +DAEMON=/usr/lib/accumulo/bin/start-server.sh +IP=`ifconfig | grep inet[^6] | awk '{print $2}' | sed 's/addr://' | grep -v 0.0.0.0 | grep -v 127.0.0.1 | head -n 1` +DAEMON_ARGS="$IP slaves" +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Read configuration variable file if it is present +[ -r /etc/default/accumulo ] && . /etc/default/accumulo + +# Load the VERBOSE setting and other rcS variables +if [ -f /lib/init/vars.sh ]; then + . /lib/init/vars.sh +else + log_daemon_msg() { logger "$@"; } + log_end_msg() { [ $1 -eq 0 ] && RES=OK; logger ${RES:=FAIL}; } +fi + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.2-14) to ensure that this file is present +# and status_of_proc is working. +. /lib/lsb/init-functions + +# +# Function that starts the daemon/service +# +do_start() +{ + TARGET_USER_NAME="ACCUMULO_USER" + TARGET_USER=$(eval "echo \$$TARGET_USER_NAME") + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + + if [ "`jps -m | grep $ACCUMULO_PROC1`" -a "`jps -m | grep $ACCUMULO_PROC2`" ] ; then return 1; fi + + su -s /bin/sh $TARGET_USER -c "/usr/lib/accumulo/bin/start-server.sh $IP logger" + su -s /bin/sh $TARGET_USER -c "/usr/lib/accumulo/bin/start-server.sh $IP tserver \"tablet server\"" + + if [ "`jps -m | grep $ACCUMULO_PROC1`" -a "`jps -m | grep $ACCUMULO_PROC2`" ] ; then return 0; fi + return 2 + # Add code here, if necessary, that waits for the process to be ready + # to handle requests from services started subsequently which depend + # on this one. As a last resort, sleep for some time. +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + + if [ ! "`jps -m | grep $ACCUMULO_PROC1`" -a ! "`jps -m | grep $ACCUMULO_PROC2`" ] ; then return 1; fi + + su -s /bin/sh $TARGET_USER -c "/usr/lib/accumulo/bin/accumulo admin stop $IP" + + if [ "`jps -m | grep $ACCUMULO_PROC1`" ] ; then jps -m | grep $ACCUMULO_PROC1 | awk '{print $1}' | xargs kill -9; fi + if [ "`jps -m | grep $ACCUMULO_PROC2`" ] ; then jps -m | grep $ACCUMULO_PROC2 | awk '{print $1}' | xargs kill -9; fi + + if [ "`jps -m | grep $ACCUMULO_PROC1`" -a "`jps -m | grep $ACCUMULO_PROC2`" ] ; then return 2; fi + + return 0; +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + #reload|force-reload) + # + # If do_reload() is not implemented then leave this commented out + # and leave 'force-reload' as an alias for 'restart'. + # + #log_daemon_msg "Reloading $DESC" "$NAME" + #do_reload + #log_end_msg $? + #;; + restart|force-reload) + # + # If the "reload" option is implemented then remove the + # 'force-reload' alias + # + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: Propchange: accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-slave ------------------------------------------------------------------------------ svn:executable = * Added: accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-tracer URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-tracer?rev=1417662&view=auto ============================================================================== --- accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-tracer (added) +++ accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-tracer Wed Dec 5 21:55:08 2012 @@ -0,0 +1,159 @@ +#! /bin/sh +# chkconfig: 2345 21 20 +### BEGIN INIT INFO +# Provides: accumulo-tracer +# Required-Start: $network $local_fs zookeeper-server +# Required-Stop: $network $local_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: accumulo tracer +# Description: The accumulo tracer provides a mechanism for tracing accumulo calls +### END INIT INFO + +# 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. + +# Do NOT "set -e" +install -d -m 0775 -o root -g accumulo /var/run/accumulo + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/accumulo/bin +DESC="Accumulo Tracer" +NAME=accumulo-tracer +ACCUMULO_PROC=tracer +DAEMON=/usr/lib/accumulo/bin/start-server.sh +IP=`ifconfig | grep inet[^6] | awk '{print $2}' | sed 's/addr://' | grep -v 0.0.0.0 | grep -v 127.0.0.1 | head -n 1` +DAEMON_ARGS="$IP tracer" +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Read configuration variable file if it is present +[ -r /etc/default/accumulo ] && . /etc/default/accumulo + +# Load the VERBOSE setting and other rcS variables +if [ -f /lib/init/vars.sh ]; then + . /lib/init/vars.sh +else + log_daemon_msg() { logger "$@"; } + log_end_msg() { [ $1 -eq 0 ] && RES=OK; logger ${RES:=FAIL}; } +fi + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.2-14) to ensure that this file is present +# and status_of_proc is working. +. /lib/lsb/init-functions + +# +# Function that starts the daemon/service +# +do_start() +{ + TARGET_USER_NAME="ACCUMULO_TRACER_USER" + TARGET_USER=$(eval "echo \$$TARGET_USER_NAME") + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + + if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi + + su -s /bin/sh $TARGET_USER -c "$DAEMON $DAEMON_ARGS > /dev/null || return 1" + + if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 0; fi + return 2 + # Add code here, if necessary, that waits for the process to be ready + # to handle requests from services started subsequently which depend + # on this one. As a last resort, sleep for some time. +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + + if [ ! "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi + + jps -m | grep $ACCUMULO_PROC | awk '{print $1}' | xargs kill -9 + + if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 2; fi + + return 0; +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + #reload|force-reload) + # + # If do_reload() is not implemented then leave this commented out + # and leave 'force-reload' as an alias for 'restart'. + # + #log_daemon_msg "Reloading $DESC" "$NAME" + #do_reload + #log_end_msg $? + #;; + restart|force-reload) + # + # If the "reload" option is implemented then remove the + # 'force-reload' alias + # + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: Propchange: accumulo/branches/1.4/src/assemble/scripts/init.d/accumulo-tracer ------------------------------------------------------------------------------ svn:executable = * Added: accumulo/branches/1.4/src/assemble/scripts/slave-only-init.sh URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/assemble/scripts/slave-only-init.sh?rev=1417662&view=auto ============================================================================== --- accumulo/branches/1.4/src/assemble/scripts/slave-only-init.sh (added) +++ accumulo/branches/1.4/src/assemble/scripts/slave-only-init.sh Wed Dec 5 21:55:08 2012 @@ -0,0 +1,46 @@ +#! /bin/sh +# 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. + +if [ $(id -ur) -ne 0 ]; then + echo "This script must be run as root" 1>&2 + exit 1 +fi + +if [ ! -f /etc/default/accumulo ]; then + mkdir -p /etc/default + touch /etc/default/accumulo +fi + +if ! grep "ACCUMULO_USER=" /etc/default/accumulo >> /dev/null ; then + echo "ACCUMULO_USER=accumulo" >> /etc/default/accumulo +fi + +if ! id -u accumulo >/dev/null 2>&1; then + groupArg="U" + if egrep "^accumulo:" /etc/group >> /dev/null; then + groupArg="g accumulo" + fi + useradd -$groupArg -d /usr/lib/accumulo accumulo +fi + +install -m 0755 -o root -g root init.d/accumulo-slave /etc/init.d/ +if [ -e "`which update-rc.d`" ]; then + update-rc.d accumulo-slave start 21 2 3 4 5 . stop 15 0 1 6 . +elif [ -e "`which chkconfig`" ]; then + chkconfig --add accumulo-slave +else + echo "No update-rc.d or chkconfig, rc levels not set for accumulo-slave" +fi Propchange: accumulo/branches/1.4/src/assemble/scripts/slave-only-init.sh ------------------------------------------------------------------------------ svn:eol-style = native Propchange: accumulo/branches/1.4/src/assemble/scripts/slave-only-init.sh ------------------------------------------------------------------------------ svn:executable = *