Script de démarrage/arrêt du client ices
A mettre dans un fichier /etc/init.d/ices-start-stop.sh et le tester.
#!/bin/sh
#
# $Id$
#
USER=yvan
PRG=/usr/bin/ices2
test -x ${PRG} || exit 0
CONF=/home/yvan/ices-canalb.xml
case "$1" in
start)
echo -n "Starting CANALB client:"
if [ -f "${CONF}" ]; then
/bin/su - ${USER} -c "${PRG} ${CONF}" &
echo "${PRG}."
else
echo "${CONF} : No such file."
exit 1
fi
;;
stop)
echo -n "Stopping CANALB client: ${PRG}"
PID=`/bin/ps aux | /bin/grep ices2 | /bin/grep -v grep | /usr/bin/tr -s " " | /usr/bin/cut -d " " -f2`
/bin/kill ${PID}
echo "."
;;
restart)
$0 stop
sleep 2
$0 start
;;
*)
echo "Usage: /etc/init.d/ices-start-stop {start|stop|restart}"
exit 1
esac
exit 0
Ensuite, le mettre en démarrage automatique :
update-rc.d ices-start-stop.sh defaults
