HBASE-558 Output hbase+hadoop+jvm version as well as java opts, ulimit, into master/regionserver log on startup

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@656798 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2008-05-15 19:22:54 +00:00
parent b187c39355
commit 8fc5cd2b95
1 changed files with 24 additions and 7 deletions

View File

@ -89,10 +89,21 @@ if [ "$HBASE_IDENT_STRING" = "" ]; then
export HBASE_IDENT_STRING="$USER"
fi
# some variables
# 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 HBASE_LOGFILE=hbase-$HBASE_IDENT_STRING-$command-$HOSTNAME.log
export HBASE_ROOT_LOGGER="INFO,DRFA"
log=$HBASE_LOG_DIR/hbase-$HBASE_IDENT_STRING-$command-$HOSTNAME.out
logout=$HBASE_LOG_DIR/hbase-$HBASE_IDENT_STRING-$command-$HOSTNAME.out
loglog="${HBASE_LOG_DIR}/${HBASE_LOGFILE}"
pid=$HBASE_PID_DIR/hbase-$HBASE_IDENT_STRING-$command.pid
# Set default scheduling priority
@ -111,24 +122,30 @@ case $startStop in
fi
fi
hbase_rotate_log $log
echo starting $command, logging to $log
hbase_rotate_log $logout
echo starting $command, logging to $logout
# Add to the command log file vital stats on our environment.
echo "`date` Starting $command on `hostname`" >> $loglog
$JAVA -version >> $loglog 2>&1
echo "ulimit -n `ulimit -n`" >> $loglog 2>&1
nohup nice -n $HBASE_NICENESS "$HBASE_HOME"/bin/hbase \
--config "${HBASE_CONF_DIR}" \
$command $startStop "$@" > "$log" 2>&1 < /dev/null &
$command $startStop "$@" > "$logout" 2>&1 < /dev/null &
echo $! > $pid
sleep 1; head "$log"
sleep 1; head "$logout"
;;
(stop)
if [ -f $pid ]; then
if kill -0 `cat $pid` > /dev/null 2>&1; then
echo -n stopping $command
echo "`date` Stopping $command" >> $loglog
if [ "$command" = "master" ]; then
nohup nice -n $HBASE_NICENESS "$HBASE_HOME"/bin/hbase \
--config "${HBASE_CONF_DIR}" \
$command $startStop "$@" > "$log" 2>&1 < /dev/null &
$command $startStop "$@" > "$logout" 2>&1 < /dev/null &
else
echo "`date` Killing $command" >> $loglog
kill `cat $pid` > /dev/null 2>&1
fi
while kill -0 `cat $pid` > /dev/null 2>&1; do