Skip to content

Instantly share code, notes, and snippets.

@ibalashov
Created December 9, 2015 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ibalashov/08c9004f717954bdaaf8 to your computer and use it in GitHub Desktop.
Save ibalashov/08c9004f717954bdaaf8 to your computer and use it in GitHub Desktop.
#!/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