#! /bin/sh
### BEGIN INIT INFO
# Provides:          local.dezign
# Required-Start:    $start
# Required-Stop:     $shutdown
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: dezign watchdog
# Description:       dezign watchdog
### END INIT INFO
# Author: dresden elektronik

# Aktionen
NAME=local.dezign
DESC="dezign watchdog"

start() {
  echo 'Starting service…' >&2
  sh /home/root/de/dezign/dezign.wdt &
  echo 'Service started' >&2
  
  if [ -f /mnt/dezign/work/bin/plugins.sh ]; then
    echo "start plugin worker" >&2
    sh /mnt/dezign/work/bin/plugins.sh &
  fi
}

install() {
  echo "insalling $NAME" >&2
  cp "$0" /etc/init.d/
  chmod 755 /etc/init.d/$NAME
  update-rc.d $NAME defaults
  echo "insalled $NAME" >&2
}

case "$1" in
  start)
    start
	;;
  stop)
	;;
  reload)
	;;
  restart|force-reload)
  	$0 stop
	sleep 8
	$0 start
	;;
  status)
	;;
  install)
    install
  ;;
  *)
	N=/etc/init.d/$NAME
	echo "Usage: $N {start|stop|restart|force-reload|reload|status}" >&2
	exit 1
	;;
esac

exit 0