systemd script for rtc clock

This forum is for topics specific to the Raspberry Pi and Arch Linux ARM

systemd script for rtc clock

Postby Mauron » Fri Dec 21, 2012 4:57 pm

Hi there!
Before opening this topic, I tried to search for it but forum Search field seems to be a little messed up.

I have an RTC module, I linked it to the Pi by following some guides on the net about it and I managed to see the original time set, write the actual one on it and set system time from it by using hwclock, so it does work.

My problem is that I should recreate the device every time I boot by giving
$this->bbcode_second_pass_code('', 'echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device')
as root; I could automatically do this by creating a systemd service script.
So here's mine:
$this->bbcode_second_pass_quote('rtclock.service', '[')code][Unit]
Description=RTC clock
Before=openntpd.service

[Type]
Type=oneshot
RemainAfterExit=1

[Service]
ExecStart=/bin/bash echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device
ExecStartPost=/bin/bash hwclock -s

[/code]


I named it rtclock.service, I put it in /etc/systemd/system/rtclock.service but it doesn't work

How should I write it?
Thank you for help.
Mauron
 
Posts: 33
Joined: Thu Aug 09, 2012 9:26 am

Re: systemd script for rtc clock

Postby Mauron » Sat Dec 22, 2012 2:23 am

Ok, I solved by following this guide.
Mauron
 
Posts: 33
Joined: Thu Aug 09, 2012 9:26 am

Re: systemd script for rtc clock

Postby keypunch » Sat Jul 06, 2013 5:42 pm

Mauron,

Sadly the link your provided does not work anymore. I suspect it is because the person passed away unexpectedly early February 2013. Very unfortunate and sad.

Can you explain what you did to resolve your RTC challenge?

I am using a Raspberry Pi with Arch ARM Linux which I am happy with. Initially I installed from the base .img of early this year. A week ago I received a DS3231 based RTC which used the DS1307 driver. I have the RTC activated in sense hwclock can see the DS3231 every time I boot the RPi. Using "hwclock -s" at the command line after the RPi is booted does set the Linux Kernel clock from the DS3231 RTC clock. What I have not been successful in achieving is the Linux Kernel clock set automatically to the time from the DS3132 RTC at boot when using Arch ARM Linux. I have tried the using a modified version of the suggested systemd file of posting <http://archlinuxarm.org/forum/viewtopic.php?f=9&t=4876&start=20#p27785> and a few variants of with no success.

I have been using Linux since 1999, can configure/compile kernels and any of the open source from scratch. I have used Debian for a few years now, but I need go to a different distribution as Debian has become too buggy in last few years for my tastes. Gentoo is a likely possibility, but I have not done so yet until I have the time to do this. Point is I am experienced with Linux, just not systemd and RTCs that always exists on standard systems.

I would really like to continue to use Arch ARM Linux on the RPi as it works very well, is fast and stable. Any help, pointers, links, et al you can provide would be most helpful. I need to run the RPi without an internet connection, hence the need for the RTC as the application I am running is time driven.
keypunch
 
Posts: 1
Joined: Sat Jul 06, 2013 5:26 pm

Re: systemd script for rtc clock

Postby lemoneer » Tue Jul 16, 2013 7:41 pm

keypunch,

I have just finished getting the ChronoDot to work on the Beagle Bone Black and wrote a guide. All the software configuration steps should work on the Pi. Please see blog.lemoneerlabs.com
lemoneer
 
Posts: 7
Joined: Thu Jun 27, 2013 2:51 pm


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 57 guests