#!/bin/sh # # 3dm2: Starts the 3ware daemon # # Author: Rafal Cygnarowski # # chkconfig: 345 40 60 # description: Start the 3dm2 application which logs the current state # of the 3ware DiskSwitch controller card, and then polls # for state changes. # # processname: 3dm2 # config: /etc/3dm2/3dm2.conf # Source function library. . /etc/rc.d/init.d/functions RETVAL=0 start() { if [ ! -f /var/lock/subsys/3dm2 ]; then msg_starting "3DM2 Utility" start-stop-daemon --start --quiet --exec /usr/sbin/3dm2 RETVAL=$? if [ $RETVAL -eq 0 ]; then ok touch /var/lock/subsys/3dm2 else fail RETVAL=1 fi else msg_already_running "3DM2 Utility" fi } stop() { # FIXME: stop should NEVER fail with error code if [ -f /var/lock/subsys/3dm2 ]; then msg_stopping "3DM2 Utility" # FIXME: spec needs rc-scripts versioned dep for start-stop-daemon (see PLD-doc/BuildRequires.txt) start-stop-daemon --stop --quiet --exec /usr/sbin/3dm2 > /dev/null RETVAL=$? if [ $RETVAL -eq 0 ]; then ok rm -f /var/lock/subsys/3dm2 else fail RETVAL=1 fi else msg_not_running "3DM2 Utility" fi } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status 3dm2 RETVAL=$? ;; restart) stop sleep 2 start ;; *) msg_usage "$0 {start|stop|status|restart}" exit 3 esac exit $RETVAL