So, basically I am using wiringPI library and its sample code for ds1302 chip. It works great by the way - writing and reading to and from ds1302 chip is a breeze. I can initiate PI's date and time update with ds1302 date and time and vice versa. I want to automate this process for boot-time and periodic update of ds1302 chip with PI's date and time. I got the boot-time PI's date and time update from ds1302 date and time by calling a script at boot.
For periodic update of ds1302 date time from PI's date time, I am using sudo crontab -e
The script itself is working as expected but not updating my ds1302 chip's date time. In the crontab, I have the following.
* * * * * date>>/home/pi/script/cron.txt
* * * * * sudo ./home/pi/script/ds1302 -sdsc
I know crontab is working, because I do see cron.txt with time stamp for every minute, but the ds1302 chip date time has not updated to the PI's date time. The weird thing is that if I were to execute the command, sudo ./home/pi/script/ds1302 -sdsc
on the terminal, it WORKS instantly. So, why won't crontab run the command or having difficulty running the command?
/home/pi/script/
.