I'm new to Arduino's world and that's my very first post.
I'm working with an Arduino YUN connected to a RTC module and everything works fine: I can interface with the board via I2C and I can get the date and time. The need here is to have the correct sys date even in case YUN loses the wifi connection or power is missing. Now, to meet this requirement I need the sketch to retrieve date and time form the RTC and set the sys date accordingly. I'm trying to use the Process lib to call 'date' process on OpenWrt side, but it seems it doesn't work at all.
Here my code:
Process p; p.begin("date"); p.addParameter(unixDateTime); p.run();
Where unixDateTime is the date and time coming from RTC in the correct format accepted by date. System date is not updated. I tried to manually set the date and time via SSH using the same String I'm passing as parameter and I receive the follwoing error:
$ date 052113422011.53 date: bind: Permission denied date: settimeofday (timeval): Operation not permitted
So I tried to add 'sudo' this way:
Process p; p.begin("[b]echo arduino | sudo[/b] date"); p.addParameter(unixDateTime); p.run();
Again, not working. Does anybody know the right way?