Review Board 1.7.22


Use init script templates for HBase

Review Request #10778 - Created April 25, 2013 and updated

Sean Mackrory
master
BIGTOP-936
Reviewers
bigtop
bigtop
Intended to be applied over BIGTOP-732. HBase currently has 3 distribution-specific init script templates, but this patch combines them all the use one template shared with other services. This reduces maintenance overhead now, and will make it easier to migrate to SysV-init replacements in the future.
Built and installed on Ubuntu 12, RHEL 6 and SLES 11. Started, stopped, restarted and checked status multiple times. Checked pid files, logs, process behavior, return values and environment for consistency.
bigtop-packages/src/common/hbase/hbase.svc
New File

    
   
1
# Licensed to the Apache Software Foundation (ASF) under one or more

    
   
2
# contributor license agreements.  See the NOTICE file distributed with

    
   
3
# this work for additional information regarding copyright ownership.

    
   
4
# The ASF licenses this file to You under the Apache License, Version 2.0

    
   
5
# (the "License"); you may not use this file except in compliance with

    
   
6
# the License.  You may obtain a copy of the License at

    
   
7
#

    
   
8
#     http://www.apache.org/licenses/LICENSE-2.0

    
   
9
#

    
   
10
# Unless required by applicable law or agreed to in writing, software

    
   
11
# distributed under the License is distributed on an "AS IS" BASIS,

    
   
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

    
   
13
# See the License for the specific language governing permissions and

    
   
14
# limitations under the License.

    
   
15

   

    
   
16
DAEMON="hbase-@HBASE_DAEMON@"

    
   
17
DESC="HBase @HBASE_DAEMON@ daemon"

    
   
18
EXEC_PATH="/usr/lib/hbase/bin/hbase-daemon.sh"

    
   
19
SVC_USER="hbase"

    
   
20
DAEMON_FLAGS=""

    
   
21
CONF_DIR="${HBASE_CONFIG:-/etc/hbase/conf}"

    
   
22
PIDFILE="${SQOOP_PID:-/var/run/hbase/hbase-${DAEMON}.pid}"

    
   
23
LOCKDIR="/var/lock/subsys"

    
   
24
LOCKFILE="${DAEMON}"

    
   
25

   

    
   
26
generate_functions() {

    
   
27
cat <<'__EOT__'

    
   
28

   

    
   
29
hbase_env() {

    
   
30
    export HBASE_HOME=/usr/lib/hbase

    
   
31
    . /etc/default/hbase

    
   
32
}

    
   
33

   

    
   
34
__EOT__

    
   
35
}

    
   
36

   

    
   
37
generate_start() {

    
   
38

   

    
   
39
cat <<'__EOT__'

    
   
40
start() {

    
   
41
    hbase_env

    
   
42

   

    
   
43
    [ -x $EXEC_PATH ] || exit $ERROR_PROGRAM_NOT_INSTALLED

    
   
44
    log_success_msg "Starting $DESC (${DAEMON}): "

    
   
45

   

    
   
46
    checkstatusofproc

    
   
47
    status=$?

    
   
48
    if [ "$status" -eq "$STATUS_RUNNING" ]; then

    
   
49
        log_success_msg "${DESC} is running"

    
   
50
        exit 0

    
   
51
    fi

    
   
52

   

    
   
53
    su -s /bin/sh hbase -c "${EXEC_PATH} start @HBASE_DAEMON@"

    
   
54

   

    
   
55
    checkstatusofproc

    
   
56
    RETVAL=$?

    
   
57
    [ $RETVAL -eq $STATUS_RUNNING ] && touch $LOCKFILE

    
   
58
    return $RETVAL

    
   
59
}

    
   
60
__EOT__

    
   
61

   

    
   
62
}

    
   
63

   

    
   
64
generate_stop() {

    
   
65

   

    
   
66
cat <<'__EOT__'

    
   
67
stop() {

    
   
68
    hbase_env

    
   
69

   

    
   
70
    log_success_msg "Stopping $DESC (${DAEMON}): "

    
   
71
    su -s /bin/sh hbase -c "${EXEC_PATH} stop @HBASE_DAEMON@"

    
   
72
    sleep 3

    
   
73
    RETVAL=$?

    
   
74

   

    
   
75
    [ $RETVAL -eq $RETVAL_SUCCESS ] && rm -f $LOCKFILE $PIDFILE

    
   
76
    return $RETVAL

    
   
77
}

    
   
78
__EOT__

    
   
79

   

    
   
80
}

    
   
81

   
bigtop-packages/src/deb/hbase/install_init_scripts.sh
Revision f60059c New Change
 
bigtop-packages/src/deb/hbase/service-init.d.tpl
Revision 9260c71 New Change
 
bigtop-packages/src/rpm/hbase/SOURCES/hbase.sh
Revision 3cdcea4 New Change
 
bigtop-packages/src/rpm/hbase/SOURCES/hbase.sh.suse
Revision 5452e00 New Change
 
bigtop-packages/src/rpm/hbase/SPECS/hbase.spec
Revision d698bdf New Change
 
bigtop-packages/src/templates/init.d.tmpl
Revision 61db5d5 New Change
 
  1. bigtop-packages/src/common/hbase/hbase.svc: Loading...
  2. bigtop-packages/src/deb/hbase/install_init_scripts.sh: Loading...
  3. bigtop-packages/src/deb/hbase/service-init.d.tpl: Loading...
  4. bigtop-packages/src/rpm/hbase/SOURCES/hbase.sh: Loading...
  5. bigtop-packages/src/rpm/hbase/SOURCES/hbase.sh.suse: Loading...
  6. bigtop-packages/src/rpm/hbase/SPECS/hbase.spec: Loading...
  7. bigtop-packages/src/templates/init.d.tmpl: Loading...