~ubuntu-branches/ubuntu/precise/hbase/precise

« back to all changes in this revision

Viewing changes to debian/hbase-masterd.init

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Koch
  • Date: 2010-05-06 14:20:42 UTC
  • Revision ID: james.westby@ubuntu.com-20100506142042-61v0vd5yj04rgeq2
Tags: 0.20.4+dfsg1-1
Initial release. (Closes: #575523)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
### BEGIN INIT INFO
 
3
# Provides:          hbase-master
 
4
# Required-Start:    $remote_fs
 
5
# Required-Stop:     $remote_fs
 
6
# Default-Start:     2 3 4 5
 
7
# Default-Stop:      0 1 6
 
8
# Should-Start:      zookeeper
 
9
# Should-Stop:       zookeeper
 
10
# Short-Description: HBase Master
 
11
# Description:       Coordinates the hbase regionservers
 
12
### END INIT INFO
 
13
 
 
14
# Author: Thomas Koch <thomas.koch@ymc.ch>
 
15
# Do NOT "set -e"
 
16
 
 
17
NAME=master
 
18
PROJECT=hbase
 
19
WRAPPER="/usr/bin/hbase $NAME start"
 
20
export HBASE_LOG_DIR=/var/log/hadoop
 
21
export HBASE_LOGFILE=hbase-$NAME.log
 
22
export HBASE_ROOT_LOGGER=INFO,DRFA
 
23
 
 
24
do_stop()
 
25
{
 
26
        # Return
 
27
        #   0 if daemon has been stopped
 
28
        #   1 if daemon was already stopped
 
29
        #   2 if daemon could not be stopped
 
30
        #   other if a failure occurred
 
31
    is_running
 
32
        RETVAL="$?"
 
33
        [ "$RETVAL" = $EXIT_FAILURE ] && return 1
 
34
        # Wait for children to finish too if this is a daemon that forks
 
35
        # and if the daemon is only ever run from this initscript.
 
36
        # If the above conditions are not satisfied then add some other code
 
37
        # that waits for the process to drop all resources that could be
 
38
        # needed by services started subsequently.  A last resort is to
 
39
        # sleep for some time.
 
40
 
 
41
    /usr/bin/hbase master stop
 
42
 
 
43
    # wait for termination
 
44
    for i in 1 2 3 4 5 6 7 8 9
 
45
    do
 
46
        is_running
 
47
        RETVAL="$?"
 
48
        [ "$RETVAL" = $EXIT_SUCCESS ] && sleep 1 && continue
 
49
        [ "$RETVAL" = $EXIT_FAILURE ] && return 0
 
50
        return $RETVAL
 
51
    done
 
52
    return 2
 
53
}
 
54
 
 
55
[ -r /usr/share/hadoop/common-init.sh ] && . /usr/share/hadoop/common-init.sh