1 | #!/bin/bash |
---|
2 | # Shell wrapper for Hadoop scripts in "$HADOOP_HOME/bin" |
---|
3 | # as a hadoop user. |
---|
4 | |
---|
5 | CMDNAME=`basename "$0"` |
---|
6 | |
---|
7 | export JAVA_HOME=@java_home@ |
---|
8 | export HADOOP_HOME=@hadoop_home@ |
---|
9 | |
---|
10 | usage() { |
---|
11 | echo "Usage: $CMDNAME [-h|--help] script [args ..]" |
---|
12 | echo "Executes a script in \"$HADOOP_HOME/bin\" as @hadoopuser@ user:" |
---|
13 | ls $HADOOP_HOME/bin |
---|
14 | exit 1 |
---|
15 | } |
---|
16 | |
---|
17 | if [ $# -eq 0 -o "$1" = "-h" -o "$1" = "--help" ]; then |
---|
18 | usage |
---|
19 | fi |
---|
20 | |
---|
21 | SCRIPT="$HADOOP_HOME/bin/$1" |
---|
22 | shift |
---|
23 | |
---|
24 | exec sudo -E -u @hadoopuser@ $SCRIPT "$@" |
---|