- echo -n "Starting mcollective: "
-
- 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
- log_success_msg
- touch $lock
- exit 0
- else
- log_failure_msg
- exit 1
- fi
+ echo "Starting daemon: " $name
+ # start the program
+ if [ -f $pidfile ]; then
+ if [ -f "$(cat /proc/$(cat $pidfile)/exe > /dev/null)" ] ; then
+ echo MCollective appears to be running
+ exit 1
+ else
+ /sbin/start-stop-daemon --start -b --quiet --oknodo -m --pidfile $pidfile --exec $mcollectived -- $daemonopts
+ [ $? = 0 ] && { exit 0 ; } || { exit 1 ; }
+ fi
+ else
+ /sbin/start-stop-daemon --start -b --quiet --oknodo -m --pidfile $pidfile --exec $mcollectived -- $daemonopts
+ fi
+ log_success_msg "mcollective started"