I have been researching for the last few days to no avail - and have resolved to just ask the question.
I'm building a museum light and sound show on a tight budget.
I have had trouble getting my DS3231 to initialize in both RC.local and Init.d
so I ended up doing it in an SH script and triggering it @reboot in root user's cron - which works.
at boot I get the following:
Code: Select all
pi@raspberrypi ~ $ sudo hwclock
Sun 12 Jul 2015 17:32:18 AEST -0.387504 seconds
as I'm using cron to trigger various mp3 playback events for the show, I had hoped to make a script to run at boot/reboot that does the following:
My current situation and config:
Situation:
Have installed a DS3231 RTC module and wish to have it do the following:
1: Initialize on boot, then sleep 5 minutes. (resolved by means of a script running @reboot in cron)
2: Check for internet connection
3: If no connection present, update system time from hwclock
4: If connection present, check NTP, then update system clock - then hwclock from system.
Setup:
Pi B+
Raspbian Kernel: 3.18.10+ (booting to GUI on touch screen)
Hardware:
*3 way Multiplexer board
*DS3231 RTC
*Prototype expansion board
*Waveshare Spotpear 3.2 inch Touchscreen
*4 way Relay board (opto-isolated)
*TP-link WN727 USB wifi (not presently working)
*Wired lan connection (during setup only)
Root Cron entry:
Code: Select all
@reboot sh /home/pi/loadclock.shCode: Select all
echo ds1307 0x68 | sudo tee /sys/class/i2c-adapter/i2c-1/new_device
sudo modprobe rtc-ds1307