Page 1 of 4

Wrong Date and time

PostPosted: Thu Sep 29, 2022 6:02 am
by myo38
Good morning,

I've decided, due to energy prices, to shut down my Fiber box and my CloudBox during the night.
At restart, as the CloudBox is faster to restart than the Fiber box, the CloudBox doesn't get date and Time from the web. So it has a wrong value such as 01/01/2018 01:57:43 at this precise moment.
That makes file recording with wrong dates.

I had precisely the same issue with native LaCie firmaware.

Does it exist a solution ? Or should the firmware be modified to update Date and Time on some occasions ?

Thanks,
Michel

Re: Wrong Date and time

PostPosted: Sun Oct 16, 2022 3:19 pm
by Jocko
Hi

Yes you can restart the ntp service by running a cron-boot script where you set a delay

So from the fw web-interface, load "Boot jobs" menu :
- install the feature if not already done (click on the button "Set up Boot jobs")
- enable Boot jobs

Now save the attached tarball in the subfolder "cron-boot" and uncompress it, here (from a shell window, run
Code: Select all
cd /direct-usb/fvdw/cron-boot
tar -xf restart-ntp-client-script.tgz -C .
(Now you should have a new file "restart-sync-ntp-daemon.php")

Return to fw web-interface and reload "Boot jobs" menu. You should see a new line with the script in jobs list area. Then check the line (first column) and save your change (click on the button "Save Boot jobs table")

So on next nas rebooting, the firmware will try to start again after 90'' the ntp service when it will complete the regular boot script. Indeed in the custom script it waits on 90 '' (line 23) .
You can easily change the value if it is too long or not enough

Re: Wrong Date and time

PostPosted: Mon Oct 17, 2022 4:32 pm
by myo38
Jocko,

My greatests thanks for your help. It works very fine.

I appreciate,
Michel.

Re: Wrong Date and time

PostPosted: Fri Oct 28, 2022 5:39 pm
by myo38
Jocko, or anyone esle,

I need you help because it seems that the cron you gave me isn't anymore working (has it been realy sometimes, I don't know).

Within the cron log file I have the message 'crond: time disparity of 2533922 minutes detected'. Does this mean something ?

And besides this is there a way of running the cron 'on the fly' to test it ?

Tanks for any help taht could be provided.

Michel.

Re: Wrong Date and time

PostPosted: Sat Oct 29, 2022 12:07 pm
by Jocko
Hi myo

Can you post these outputs
Code: Select all
grep '<ntp>' /etc/nas_conf_db.xml -A5
cat /rw_fs/etc/cronbootscript.sh
ls -al /direct-usb/fvdw/cron-boot/restart-sync-ntp-daemon.php
php -l /direct-usb/fvdw/cron-boot/restart-sync-ntp-daemon.php

Re: Wrong Date and time

PostPosted: Sat Oct 29, 2022 5:25 pm
by myo38
Hi Jocko,

Thanks for the quick reply.

Sure I can if you give me some help !

I'm accessing my NAS from a Windows system. I tried to run ssh from Windows power shell but couldn't connect to the NAS : wrong password either using admin-nas or my user account.

So some help would be efficient !

Michel.

Re: Wrong Date and time

PostPosted: Sat Oct 29, 2022 5:25 pm
by myo38
Hi Jocko,

Thanks for the quick reply.

Sure I can if you give me some help !

I'm accessing my NAS from a Windows system. I tried to run ssh from Windows power shell but couldn't connect to the NAS : wrong password either using admin-nas or my user account.

So some help would be efficient !

Michel.

Re: Wrong Date and time

PostPosted: Sat Oct 29, 2022 5:33 pm
by Jocko
Hi

For ssh access you have to use the login 'root' and if you do not yet change the password, default pwd is 'giveit2me'

(admin-nas must be used only to get the admin access on the fw web-interface)

Re: Wrong Date and time

PostPosted: Sun Oct 30, 2022 8:00 am
by myo38
Hello,

Yes, I remembered this and tried it.

********************
Once logged in, if I use the command grep as required it says :
grep: S: invalid context length argument

If I use only -A it says :
grep: option requires an argument -- 'A'
Usage: grep [OPTION]... PATTERN [FILE]...

If i use no argument it replies : <ntp>

********************

The second command gives :
Code: Select all
#!/bin/sh

#Stop if boot mode is 'fs_setup'
boot_type=$(/bin/grep '"boot_type"' /etc/inc/globals.inc|/usr/bin/awk -F '"' '{print $4 }')
[ "$boot_type" = 'fs_setup' ] && exit 0

 #Run the following scripts found in the folder:
# /share/1000/fvdw/cron-boot

#MAJ de l'heure oprès boot
        FILE=/direct-usb/fvdw/cron-boot/restart-sync-ntp-daemon.php
        if [ -f  $FILE ]
        then
                echo -e '\n\tMAJ de l'heure oprès boot' >>/boot.log
                echo -e '\t/direct-usb/fvdw/cron-boot/restart-sync-ntp-daemon.php' >>/boot.log
                /usr/bin/php -f $FILE >>/boot.log
        fi

echo -e '\nuser boot commands ended' >>/boot.logroot@Serveur-Maison:/ #[/color][/color]
                /usr/bin/php -f $FILE >>/boot.log

*******************
Third command gives :
-rw-rw-rw-  1 nobody nobody 830 2018-01-01 14:12 /direct-usb/fvdw/cron-boot/restart-sync-ntp-daemon.php

********************
And finally last command :
root@Serveur-Maison:/ # php -l /direct-usb/fvdw/cron-boot/restart-sync-ntp-daemon.php
No syntax errors detected in /direct-usb/fvdw/cron-boot/restart-sync-ntp-daemon.php

I hope it helps

Thanks again for your time

Michel.

Re: Wrong Date and time

PostPosted: Sun Oct 30, 2022 8:21 am
by Jocko
Hi

So all is ok with the outputs. About the first command, maybe you forgort the quote so you have to perform the command with this syntax
Code: Select all
grep '<ntp>' /etc/nas_conf_db.xml -A5