Hardware Reference
In-Depth Information
echo ds1307 ${address} > /sys/class/i2c-adapter/i2c-0/new_device
RETVAL=$?
touch /var/lock/subsys/pi-rtc
if [ ${RETVAL} -eq 0 ]
then
success
else
failure
fi
echo
return $RETVAL
}
stop() {
echo -n "Stopping I2C RTC : "
echo ${address} > /sys/class/i2c-adapter/i2c-0/delete_device
RETVAL=$?
rmmod rtc_ds1307
rmmod i2c-dev
rm -f /var/lock/subsys/pi-rtc
if [ $RETVAL -eq 0 ]
then
success
else
failure
fi
echo
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
*)
echo "Usage: pi-rtc {start|stop}"
exit 1
esac
exit $RETVAL
You can control this script in two ways. You can use the chkconfig tool to set or remove it from system boot or
you can use the service tool to start and stop the script when you are logged in. If you wanted to start the RTC when
you're logged in, simply run this command as root:
# service pi-rtc start
Search WWH ::




Custom Search