LinuxStartScriptExample2


/etc/init.d/bcc
#!/bin/sh
# Andreas Tobola, 2014

### BEGIN INIT INFO
# Provides:          bcc
# Required-Start:
# Required-Stop:
# Default-Start:     2
# Default-Stop:      0 1 2 3 4 5 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO


# The name of the deamon
# Blue Case Control
DAEMON=bcc

touch /var/lock/$DAEMON

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    #/home/pi/system/speak `python /home/pi/ATmega16/systemVoltage.py`
    start-stop-daemon --background --start --pidfile /var/run/$DAEMON.pid --make-pidfile -N -1 --exec /usr/bin/python /home/pi/sys
    echo "Blue Cace control daemon started."
    /home/pi/system/speak "blu kejs kontrollsystem gestartet." &
    ;;
  stop)
    start-stop-daemon --stop --pidfile /var/run/$DAEMON.pid
    echo "Blue Case control daemon stoped."
    python /home/pi/system/kbcc.py
    echo "I2C-Devices reset and giving back control to ATmega."
    /home/pi/system/speak "blu kejs kontrollsystem beendet." &
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  *)
    echo "Usage: /etc/init.d/$DAEMON {start|stop}"
    exit 1
    ;;
esac

exit 0





Siehe auch
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki