#!/bin/sh
#
# Scope / MSL driver load/unload
# Install in /etc/init.d/S##scope
#
# J. Kelley 
# 28 July 2009
# j.kelley@astro.ru.nl
#

kernel=`uname -r`
dev="/dev/scope"
module="/root/auger2/modules/$kernel/msl.ko"

if [ ! -f $module ] ; then
    echo Module file $module not found!
    exit 1
fi

if [ ! -c $dev ] ; then
    echo Device file $dev does not exist!
    exit 1
fi

start() {
    echo -n "Loading scope module: "
    insmod $module
    echo "OK"
}
stop() {
    echo -n "Unloading scope module: "
    rmmod $module
    echo "OK"
}
restart() {
	stop
	start
}

case "$1" in
  start)
      start
      ;;
  stop)
      stop
      ;;
  restart|reload)
      restart
      ;;
  *)
      echo "Usage: $0 {start|stop|restart}"
      exit 1
esac

exit $?

