#!/bin/bash
#
# /etc/init.d/hasdrtc
#
# chkconfig: 2345 20 01
# description: Correct DRTC.
#
# System startup script for correcting DRTC.
#
# COPYRIGHT (C) NEC CORPORATION 2009, 2010
# Rev.4
#

# Source function library.
. /etc/rc.d/init.d/functions

prog=hasdrtc

RETVAL=0

start() {
        echo -n "Starting $prog: "
	/opt/nec/hasdrtc/makecronfile
	RETVAL=$?
	/opt/nec/hasdrtc/chkdrtccfg
	/opt/nec/hasdrtc/adjrtc && /opt/nec/hasdrtc/waitbind
	echo "Done"
	[ $? -eq 0 ] && touch /var/lock/subsys/hasdrtc
}

stop() {
       	echo -n "Stopping $prog: "
	/opt/nec/hasdrtc/waitdrtc > /dev/console
	echo "Done"
	[ $? -eq 0 ] && rm -f /var/lock/subsys/hasdrtc
}


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

exit $RETVAL

