Re: problème avec un script de démarrage
Le Fri, 15 Jan 2016 18:33:34 +0100,
"benoit szczygiel Z.elec" <benoit@z-elec.com> a écrit :
> Bonjour,
>
> Comme indiqué dans le titre, j'ai un problème avec un script qui
> doit démarrer avec la machine. En fait j'ai 2 soucis, quand je laisse
> la ligne . /lib/lsb/init-functions, mon démon (eibd) ne démarre pas
> quand je lance le script. Si je désactive la ligne, au démarrage le
> démon ne démarre pas non plus. Le script se trouve dans /etc/init.d
> avec les droits d'éxecutions, j'ai fait un rc-update, le lien
> apparait bien dans /etc.rc2.d comme eibdS06.
>
> Debian jessie à jour.
>
> eibd: (pièce jointe)
>
>
> Merci pour les idées
>
bonjour,
attention au shebang :
https://fr.wikipedia.org/wiki/Shebang
attention à l'interface eth0 ou wifi
set chmod +x ?
slt
bernard
#! /bin/sh
### BEGIN INIT INFO
# Provides: eibd
# Required-Start: $portmap
# Required-Stop: $all
# Default-Start: S
# Default-Stop: 0 1 6
# Short-Description: Start eibd service at the end of boot
# Description: This services is for communications with knx/eib.
### END INIT INFO
# by benoit @ z-elec.com
PATH=/sbin:/usr/sbin:/bin:/usr/bin
NAME=eibd
DAEMON=/usr/local/bin/eibd
DAEMON_ARGS="-u -i -d ipt:192.168.4.11"
PIDFILE=/var/run/eibd.pid
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
#. /lib/lsb/init-functions
if [ ! -x $DAEMON ]; then
echo "eibd appears to be uninstalled."
fi
#
# Function that starts the daemon/service
#
do_start()
{
echo -n "Starting eibd"
PID=`$DAEMON $DAEMON_ARGS /dev/null 2>&1 & echo $!`
echo "Saving PID" $PID " to " $PIDFILE
echo $PID $PIDFILE
echo " done"
}
do_stop()
{
echo "Stoping eibd"
PID=`cat $PIDFILE`
kill $PID & /dev/null
echo "done"
}
#
# Function that stops the daemon/service
#
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
restart)
do_stop
sleep 1
do_start
;;
status)
echo " 1"
pid=$(pidofproc -p $PIDFILE $DAEMON)
ret=$?
pid=${pid% } # pidofproc() supplies a trailing space, strip it
if [ $ret -eq 0 ]; then
echo "eibd is running (PID: $pid)"
exit 0
elif [ $ret -eq 1 ] || [ $ret -eq 2 ]; then
echo "eibd is dead, although $PIDFILE exists."
exit 1
elif [ $ret -eq 3 ]; then
echo "eibd is not running."
exit 3
fi
echo "sais pas"
;;
*)
echo "usage: $0 {start|stop|restart|status}"
exit 1
esac
Reply to: