#! /bin/sh

start() {
      echo -n "Starting han2mbus... "
      killall han2mbus
      echo "1111" > /tmp/han2mbus.pid
      if [ ! -f /tmp/han_*.cache ]
      then
        if [ -f /data/han2mbus/han_*.cache ]
        then
          cp /data/han2mbus/han_*.cache /tmp
        fi
      fi
      /binary/han2mbus &> /dev/null &

      echo "done"
}


stop() {
      echo -n "han2mbus..."
      killall han2mbus
      echo "done"
}

restart() {
      stop
      start
}

# See how we were called.
case "$1" in
  start)
      start
      ;;
  stop)
      stop
      ;;
  restart|reload)
      restart
      ;;
  *)
      echo "Usage: $0 {start|stop|reload|restart}"
      exit 1
esac

exit $?
