#! /bin/sh #### BEGIN INIT INFO ## Provides: mon-thresh ## Required-Start: $nimbus ## Required-Stop: ## Default-Start: 2 3 4 5 ## Default-Stop: ## Short-Description: Monitoring threshold engine running under storm ## Description: #### END INIT INFO case "$1" in start) sudo -Hu thresh /opt/storm/current/bin/storm jar /opt/mon/mon-thresh.jar com.hpcloud.mon.ThresholdingEngine /etc/mon/mon-thresh-config.yml thresh-cluster ;; stop) sudo -Hu thresh /opt/storm/current/bin/storm kill thresh-cluster # The above command returns but actually takes awhile loop watching status while true; do sudo -Hu thresh /opt/storm/current/bin/storm list |grep thresh-cluster if [ $? -ne 0 ]; then break; fi sleep 1 done ;; status) sudo -Hu thresh /opt/storm/current/bin/storm list |grep thresh-cluster ;; restart) $0 stop $0 start ;; esac