5ea6af70b0
The java package names changed from 'backtype..' to 'org.apache..'. This change will work for both old (0.9) and new (1.0) versions of storm. Change-Id: Ibf19508ee5a190e6091212bbc8c8d340d5441848
68 lines
1.2 KiB
Plaintext
68 lines
1.2 KiB
Plaintext
#!/bin/bash
|
|
#
|
|
# /etc/init.d/storm-<%= @storm_service %>
|
|
#
|
|
# Startup script for storm-<%= @storm_service %>
|
|
#
|
|
# description: Starts and stops storm-<%= @storm_service %>
|
|
#
|
|
stormBin=<%= @storm_install_dir %>/bin/storm
|
|
stormSvc=<%= @storm_service %>
|
|
desc="Storm $stormSvc daemon"
|
|
outFile="/var/log/storm/storm-$stormSvc.out"
|
|
|
|
if ! [ -f $stormBin ]; then
|
|
echo "storm binary not found."
|
|
exit 5
|
|
fi
|
|
|
|
start() {
|
|
echo "Starting $desc (storm-$stormSvc): "
|
|
su <%= @storm_user %> -c "nohup $stormBin <%= @storm_service %> >>$outFile 2>&1 &"
|
|
RETVAL=$?
|
|
sleep 2
|
|
return $RETVAL
|
|
}
|
|
|
|
stop() {
|
|
echo "Shutting down $desc (storm-$stormSvc): "
|
|
if [ $stormSvc == "ui" ]; then
|
|
procname="storm.ui.core"
|
|
else
|
|
procname="storm.daemon.$stormSvc"
|
|
fi
|
|
|
|
pkill -f $procname
|
|
}
|
|
|
|
restart() {
|
|
stop
|
|
start
|
|
}
|
|
|
|
status() {
|
|
if [ $stormSvc == "ui" ]; then
|
|
pid=$(pgrep -f storm.ui.core)
|
|
else
|
|
pid=$(pgrep -f storm.daemon.$stormSvc)
|
|
fi
|
|
|
|
if [ -z $pid ]; then
|
|
echo "storm-$stormSvc is NOT running."
|
|
exit 1
|
|
fi
|
|
|
|
echo "storm-$stormSvc running with pid $pid"
|
|
exit 0
|
|
}
|
|
|
|
case "$1" in
|
|
start) start;;
|
|
stop) stop;;
|
|
restart) restart;;
|
|
status) status;;
|
|
*) echo "Usage: $0 {start|stop|restart}"
|
|
RETVAL=2;;
|
|
esac
|
|
exit $RETVAL
|