#! /bin/ksh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
#  
#  
# Licensed Materials - Property of IBM 
#  
# (C) COPYRIGHT International Business Machines Corp. 2008 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 
### BEGIN INIT INFO
# Provides:        SFPmonitorSensor  
# Required-Start:    ctrmc
# Required-Stop:
# Default-Start:  2 3 4 5
# Default-Stop:   0 1 6
# Description: CSM Service Focal Point Monitoring 
### END INIT INFO

case "$1" in
        start)
                if  ! /usr/bin/lssensor CSMServiceableEventSensor > /dev/null 
                then
                        /usr/bin/mksensor -i 0 -e 1 CSMServiceableEventSensor dumpfile
 			rc=$?
                else
                        exit 0
                fi
                ;;

        stop)
		if /usr/bin/lssensor CSMServiceableEventSensor >  /dev/null 
                then
               		/usr/bin/rmsensor CSMServiceableEventSensor 
                fi
                exit 0
                ;;

        status)
                /usr/bin/lssensor CSMServiceableEventSensor
                rc=$?
                ;;

        restart|reload)
                if /usr/bin/lssensor CSMServiceableEventSensor > /dev/null
		then
                	/usr/bin/rmsensor CSMServiceableEventSensor
		fi
                /usr/bin/mksensor -i 0 -e 1 CSMServiceableEventSensor dumpfile 
                rc=$?
                ;;

        *)
		echo "Usage: SFPmonitorSensor {start|stop|status|restart}"
                exit 1
                ;;
esac

exit $rc

