X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=ext%2Fsolaris%2Fmcollective.init;fp=ext%2Fsolaris%2Fmcollective.init;h=e94df915a45bf885f20f4a35bd89d927ed08a217;hb=b87d2f4e68281062df1913440ca5753ae63314a9;hp=0000000000000000000000000000000000000000;hpb=ab0ea530b8ac956091f17b104ab2311336cfc250;p=packages%2Fprecise%2Fmcollective.git diff --git a/ext/solaris/mcollective.init b/ext/solaris/mcollective.init new file mode 100755 index 0000000..e94df91 --- /dev/null +++ b/ext/solaris/mcollective.init @@ -0,0 +1,96 @@ +#!/bin/sh +# +# mcollective Application Server for STOMP based agents +# +# description: mcollective lets you build powerful Stomp compatible middleware clients in ruby without having to worry too +# much about all the setup and management of a Stomp connection, it also provides stats, logging and so forth +# as a bonus. +# + +RUBYLIB=/opt/csw/lib/ruby/site_ruby/1.8:$RUBYLIB +export RUBYLIB + +mcollectived="/opt/csw/sbin/mcollectived" + +lock="/var/lock/mcollective" + +# PID directory +pidfile="/var/run/mcollectived.pid" + +# Check that binary exists +if [ ! -f $mcollectived ] +then + echo "mcollectived binary not found" + exit 1 +fi + +# See how we were called. +case "$1" in + start) + if [ -f ${lock} ]; then + # we were not shut down correctly + if [ -s ${pidfile} ]; then + kill `cat ${pidfile}` >/dev/null 2>&1 + fi + rm -f ${pidfile} + + rm -f ${lock} + sleep 2 + fi + + rm -f ${pidfile} + + ${mcollectived} --pid=${pidfile} --config="/etc/mcollective/server.cfg" + if [ $? = 0 ]; then + touch $lock + exit 0 + else + exit 1 + fi + ;; + stop) + if [ -s ${pidfile} ]; then + kill `cat ${pidfile}` >/dev/null 2>&1 + fi + rm -f ${pidfile} + + rm -f $lock + ;; + restart) + $0 stop + sleep 2 + $0 start + ;; + condrestart) + if [ -f $lock ]; then + $0 stop + # avoid race + sleep 2 + $0 start + fi + ;; + status) + if [ -f ${lock} ]; then + if [ -s ${pidfile} ]; then + if [ -e /proc/`cat ${pidfile}` ]; then + echo "mcollectived (`cat ${pidfile}`) is running" + exit 0 + else + echo "mcollectived (`cat ${pidfile}`) is NOT running" + exit 1 + fi + fi + else + echo "mcollectived: service not started" + exit 1 + fi + ;; + force-reload) + echo "not implemented" + ;; + *) + echo "Usage: $0 {start|stop|restart|condrestart|status}" + exit 1 + ;; +esac +exit 0