domingo, 7 de agosto de 2016

Setting the date of my raspberry pi

I use my rpi as an alarm clock.  It works well because you have mplayer and cron.  And that's basically it.   I used picolisp to wire everything together (and wrote a simple hack to snooze the alarm).

But one of the biggest annoyances is that Rpi doesn't have a clock on its own, so when it looses power (I disconnect it), the clock is reset, so the alarm clock won't work.. :(

As I've read "The Unix Programming Environment" lately, I'm quite fond of shell scripts now, and I got to this 4 level quoting that sets the date of my raspberry pi from my laptop.

ssh pi@192.168.1.38 -o ConnectTimeout=60 sudo date --set="\"`date '+%d %b %Y %H:%M:%S'`\""

I'm somewhere between very proud and very ashamed of that, but well... it does the job.

1 comentario:

José Galisteo dijo...

Como tiene conexión a internet puedes hacer que sincronice su reloj interno no?

Si no puedes probar con un chip RTC, los hay especiales para raspberry como este: http://www.banggood.com/RTC-Clock-Module-For-Raspberry-Pi-p-995167.html