|
#!/bin/sh
|
|
### BEGIN INIT INFO
|
|
# Provides: scanies-ltsp
|
|
# Default-Start: 2
|
|
# Short-Description: Demonio para scanies
|
|
### END INIT INFO
|
|
#
|
|
# Autor: Francisco Paniagua S?nchez
|
|
#
|
|
|
|
|
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
|
DAEMON=/usr/bin/scanies-ltsp.gambas
|
|
NAME=scanies-ltsp
|
|
|
|
do_start()
|
|
{
|
|
echo -n "Iniciando $NAME ..."
|
|
/usr/bin/scanies-ltsp.gambas &
|
|
echo "."
|
|
}
|
|
|
|
do_stop()
|
|
{
|
|
echo -n "Parando $NAME ..."
|
|
PID=`ps -AF | grep scanies-ltsp.gambas | grep -v grep | awk '{print $2}'`
|
|
if [ ! -z "$PID" ]; then
|
|
kill -9 $PID
|
|
fi
|
|
PID=`ps -AF | grep _scanies._tcp | grep -v grep | awk '{print $2}'`
|
|
if [ ! -z "$PID" ]; then
|
|
kill -9 $PID
|
|
fi
|
|
echo "."
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
do_start
|
|
;;
|
|
|
|
stop)
|
|
do_stop
|
|
;;
|
|
|
|
restart|reload|force-reload)
|
|
do_stop
|
|
sleep 2
|
|
do_start
|
|
;;
|
|
|
|
*)
|
|
echo "Usage: /etc/init.d/scanies-ltsp {start|stop|restart}" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|