Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Storm init script. save as /etc/init.d/storm-nimbus
#!/bin/bash
#
# /etc/init.d/storm-nimbus
#
# Startup script for storm-nimbus
#
# chkconfig: 2345 20 80
# description: Starts and stops storm-nimbus
#. /etc/init.d/functions
stormBin=/home/user/storm/storm-0.8.1/bin/storm
stormSvc=$(echo $0 | cut -d'-' -f2)
desc="Storm $stormSvc daemon"
outFile="/var/log/storm/storm-$stormSvc.out"
stormUser=user
pidFile=/var/run/storm/storm-$stormSvc.pid
if ! [ -f $stormBin ]; then
echo "storm binary not found."
exit 5
fi
if [ -f /etc/sysconfig/storm ]; then
. /etc/sysconfig/storm
fi
start() {
echo "Starting $desc (storm-$stormSvc): "
su $stormUser -c "nohup $stormBin $stormSvc >>$outFile 2>&1 &"
RETVAL=$?
return $RETVAL
}
stop() {
echo "Shutting down $desc (storm-$stormSvc): "
if [ $stormSvc == "ui" ]; then
pkill -f backtype.storm.ui.core
else
pkill -f backtype.storm.daemon.$stormSvc
fi
[ -e $pidFile ] && rm $pidFile
}
restart() {
stop
start
}
status() {
if [ $stormSvc == "ui" ]; then
pid=$(pgrep -f backtype.storm.ui.core)
else
pid=$(pgrep -f backtype.storm.daemon.$stormSvc)
fi
if [ -z $pid ]; then
echo "storm-$stormSvc is NOT running."
RETVAL=1
else
echo "storm-$stormSvc is running (pid is $pid)."
RETVAL=0
fi
}
case "$1" in
start) start;;
stop) stop;;
restart) restart;;
status) status;;
*) echo "Usage: $0 {start|stop|restart}"
RETVAL=2;;
esac
exit $RETVAL
@yulrizka

This comment has been minimized.

Copy link
Owner Author

yulrizka commented Dec 10, 2012

You could also copy this file as nimbus-supervisor to make it init script for the superviors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.