Created
December 9, 2015 09:51
-
-
Save ibalashov/08c9004f717954bdaaf8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Boot script for Spark master | |
### BEGIN INIT INFO | |
# Provides: spark-master | |
# Required-Start: $all $network | |
# Required-Stop: $all $network | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Spark-master | |
# Description: Spark-master (http://hadoop.apache.org/) | |
### END INIT INFO | |
function print_usage() { | |
echo "Usage: $0 start|stop|restart" >&2 | |
} | |
# Check for root | |
if (( ${EUID} != 0 )); then | |
echo "This must be run as root." >& 2 | |
exit 1 | |
fi | |
if (( $# != 1 )); then | |
print_usage | |
exit 1 | |
fi | |
case "$1" in | |
start|stop) | |
su hadoop -c "/home/hadoop/spark-install/sbin/start-master.sh" | |
RETVAL=$? | |
;; | |
restart) | |
$0 stop | |
$0 start | |
RETVAL=$? | |
;; | |
*) | |
print_usage | |
exit 1 | |
;; | |
esac | |
exit ${RETVAL} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment