2005-10-28 01:21:53 +02:00
|
|
|
#! /bin/sh
|
2006-01-25 19:41:48 +01:00
|
|
|
#
|
2005-10-28 01:21:53 +02:00
|
|
|
### BEGIN INIT INFO
|
2006-01-25 19:41:48 +01:00
|
|
|
# Provides: micasad
|
|
|
|
# Required-Start:
|
|
|
|
# Should-Start:
|
|
|
|
# Required-Stop:
|
|
|
|
# Should-Stop:
|
|
|
|
# Default-Start: 1 2 3 5
|
|
|
|
# Default-Stop:
|
|
|
|
# Short-Description: miCASA daemon
|
|
|
|
# Description: miCASA daemon
|
2005-10-28 01:21:53 +02:00
|
|
|
### END INIT INFO
|
2006-02-07 22:05:39 +01:00
|
|
|
MICASAD_BIN=/usr/bin/micasad.sh
|
2005-10-28 01:21:53 +02:00
|
|
|
test -x $MICASAD_BIN || exit 5
|
|
|
|
|
|
|
|
. /etc/rc.status
|
|
|
|
|
|
|
|
# Shell functions sourced from /etc/rc.status:
|
|
|
|
# rc_check check and set local and overall rc status
|
|
|
|
# rc_status check and set local and overall rc status
|
|
|
|
# rc_status -v ditto but be verbose in local rc status
|
|
|
|
# rc_status -v -r ditto and clear the local rc status
|
|
|
|
# rc_failed set local and overall rc status to failed
|
|
|
|
# rc_reset clear local rc status (overall remains)
|
|
|
|
# rc_exit exit appropriate to overall rc status
|
|
|
|
|
|
|
|
# First reset status of this service
|
|
|
|
rc_reset
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
2006-02-13 17:52:25 +01:00
|
|
|
echo "Starting miCASA daemon"
|
2006-02-18 00:14:27 +01:00
|
|
|
/sbin/startproc -f $MICASAD_BIN
|
2006-02-09 00:14:01 +01:00
|
|
|
# Remember status and be verbose
|
|
|
|
rc_status -v
|
|
|
|
;;
|
2005-10-28 01:21:53 +02:00
|
|
|
stop)
|
2006-02-19 00:01:02 +01:00
|
|
|
echo "Shutting down micasad "
|
2006-02-09 00:14:01 +01:00
|
|
|
#killproc -TERM $MICASAD_BIN
|
2006-02-18 00:14:27 +01:00
|
|
|
pid=`cat /var/run/micasad.pid` >/dev/null 2>&1
|
|
|
|
kill -s TERM $pid >/dev/null 2>&1
|
2005-10-28 01:21:53 +02:00
|
|
|
|
2006-02-09 00:14:01 +01:00
|
|
|
# Remember status and be verbose
|
|
|
|
rc_status -v
|
|
|
|
;;
|
2006-02-18 00:14:27 +01:00
|
|
|
try-restart|condrestart)
|
2006-02-19 00:01:02 +01:00
|
|
|
$0 status
|
|
|
|
if test $? = 0
|
|
|
|
then
|
|
|
|
$0 restart
|
|
|
|
else
|
|
|
|
rc_reset # Not running is not a failure.
|
|
|
|
fi
|
|
|
|
# Remember status and be quiet
|
|
|
|
rc_status
|
|
|
|
;;
|
2005-10-28 01:21:53 +02:00
|
|
|
restart)
|
2006-02-18 00:14:27 +01:00
|
|
|
## Stop the service and regardless of whether it was
|
|
|
|
## running or not, start it again.
|
2006-02-13 17:52:25 +01:00
|
|
|
echo "Restarting miCASA daemon"
|
2006-02-18 00:14:27 +01:00
|
|
|
$0 stop
|
|
|
|
$0 start
|
2005-10-28 01:21:53 +02:00
|
|
|
|
2006-02-18 00:14:27 +01:00
|
|
|
# Remember status and be quiet
|
|
|
|
rc_status
|
|
|
|
;;
|
|
|
|
status)
|
2006-02-19 00:01:02 +01:00
|
|
|
echo "Checking micasad service ..."
|
2006-02-18 00:14:27 +01:00
|
|
|
/sbin/checkproc micasad
|
2006-02-19 00:01:02 +01:00
|
|
|
res=$?
|
2006-02-18 00:14:27 +01:00
|
|
|
if [ $res == 0 ]
|
2006-02-13 17:52:25 +01:00
|
|
|
then
|
|
|
|
echo -n "0 - service up and running"
|
2006-02-18 00:14:27 +01:00
|
|
|
elif [ $res == 1 ]
|
2006-02-13 17:52:25 +01:00
|
|
|
then
|
2006-02-19 00:01:02 +01:00
|
|
|
echo -n "1 - service running under mono, /var/run/pid file exists"
|
2006-02-18 00:14:27 +01:00
|
|
|
elif [ $res == 2 ]
|
2006-02-13 17:52:25 +01:00
|
|
|
then
|
2006-02-19 00:01:02 +01:00
|
|
|
echo -n "2 - service status unknown, /var/lock/lock file exists"
|
2006-02-18 00:14:27 +01:00
|
|
|
elif [ $res == 3 ]
|
2006-02-13 17:52:25 +01:00
|
|
|
then
|
2006-02-19 00:01:02 +01:00
|
|
|
echo -n "3 - service not running"
|
2006-02-13 17:52:25 +01:00
|
|
|
else
|
2006-02-19 00:01:02 +01:00
|
|
|
echo -n "service status unknown"
|
2006-02-13 17:52:25 +01:00
|
|
|
fi
|
|
|
|
|
2006-02-19 00:01:02 +01:00
|
|
|
rc_status -v
|
2006-02-13 17:52:25 +01:00
|
|
|
;;
|
2005-10-28 01:21:53 +02:00
|
|
|
*)
|
2006-02-18 00:14:27 +01:00
|
|
|
echo "Usage: $0 {start|stop|restart|try-restart|status}"
|
2005-10-28 01:21:53 +02:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
rc_exit
|