Manual Fix for the timesave Bug in 1.0.0

Posted by Matthias 
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
Now, this forum is in read-only mode. You find details Details hereContinue on /r/PirateBox
Manual Fix for the timesave Bug in 1.0.0
August 19, 2014 05:02PM
The step about the timesave.sh script is a script for fixing this. The issue is only, that the timesave.sh as a syntax error and the routine within the openwrt package has a bug too -- in 1.0.0

I prepared the fix for 1.0.1 which is currently in beta testing.

To fix it manually:

edit /opt/piratebox/bin/timesave.sh
find
if [ `get_datetime` -lt `cat $TIMESAVE` ] ;
and replace with
if [ `get_datetime` -lt `cat $TIMESAVE` ] ; then
(missing then)

Then edit /etc/rc.local

change
/opt/piratebox/conf/piratebox.conf /opt/piratebox/bin/timesave.sh recover
with
/opt/piratebox/bin/timesave.sh /opt/piratebox/conf/piratebox.conf  recover

Additionally run:
/opt/piratebox/bin/timesave.sh /opt/piratebox/conf/piratebox.conf  install

BUT, that is no exchange for areal Real-Time-Clock. This is not available on such cheap systems.

Matthias



Edited 2 time(s). Last edit at 08/23/2014 05:58PM by Matthias.
Re: Setting correct date & installing other packages?
August 21, 2014 10:53PM
Thanks, i think I have this working; not an accurate date. but not 1970. I may not fully understand the script, but I have better settings now.

I first set the date to my local date/time

date -s "2014-08-21 15:15:02"

I then ran the function to save the time

/opt/piratebox/bin/timesave.sh /opt/piratebox/conf/piratebox.conf  save

I shut down the piratebox, waited a bit, and rebooted. Now I have at least a time in the current year

root@piratebox:~# date
Thu Aug 21 15:37:32 UTC 2014

If I really want to keep it up to date, let's say for a workshop, I can just set the date again to the correct date/time, and let the crontab update from there.

At least files have approximate date/times, that works for me.
Re: Setting correct date & installing other packages?
August 22, 2014 04:32AM
cogdog, thanks for the verbose post.
Yes, you are right.

I'll splitt this post, move it to news section.

Matthias
Re: Manual Fix for the timesave Bug in 1.0.0
August 23, 2014 03:57PM
I'm a bit confused.

It only saves the time if you run that function cogdog used
/opt/piratebox/bin/timesave.sh /opt/piratebox/conf/piratebox.conf  save

This means it always sets the time from that moment on startup, yes?
But I thought this script should save the time every x minutes automatically.
Re: Manual Fix for the timesave Bug in 1.0.0
August 23, 2014 04:51PM
Hi snipes,
if you follow the post-install instruction, then there is a crontask already setup.

you can check this with
crontab -l

Matthias
Hello !
I have fix the time problem, but when i try to put :

root@piratebox:~# crontab -l

it says :
crontab: can't open 'root': No such file or directory
Re: Setting correct date & installing other packages?
August 23, 2014 05:57PM
well, then run

/opt/piratebox/bin/timesave.sh /opt/piratebox/conf/piratebox.conf  install


This is only my signature.
Thanks a lot Matthias ! thumbs upthumbs up