#!/bin/sh

### BEGIN INIT INFO
# Provides:          rtr
# Required-Start:    $local_fs
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:
# Short-Description: router processes
### END INIT INFO

case "$1" in
  start)
        cd /rtr
        /rtr/hwdet-all.sh
        ;;
  stop)
        kill -9 `pidof sh` `pidof java` `pidof pcapInt.bin` `pidof rawInt.bin` `pidof mapInt.bin` `pidof mapInt.bin` `pidof mapInt.bin` `pidof tapInt.bin` `pidof vlan.bin` `pidof bundle.bin` `pidof socat`
        ;;
  status)
        echo java: `pidof java`
        echo pcapInt: `pidof pcapInt.bin`
        echo rawInt: `pidof rawInt.bin`
        echo mapInt: `pidof mapInt.bin`
        echo tapInt: `pidof tapInt.bin`
        echo vlan: `pidof vlan.bin`
        echo bundle: `pidof bundle.bin`
        echo socat: `pidof socat`
        ;;
  restart)
        $0 stop
        $0 start
  ;;
  *)
        echo "Usage: $N {start|stop|status|restart}" >&2
        exit 1
        ;;
esac

exit 0
