Sorry, I typed -AS instead of -A5 !
Here is the good result :
- Code: Select all
# grep '<ntp>' /etc/nas_conf_db.xml -A5
<ntp>
<enable>true</enable>
<ip1>ntp.midway.ovh</ip1>
<ip2>ntp.unice.fr</ip2>
<server>true</server>
</ntp>
Michel
# grep '<ntp>' /etc/nas_conf_db.xml -A5
<ntp>
<enable>true</enable>
<ip1>ntp.midway.ovh</ip1>
<ip2>ntp.unice.fr</ip2>
<server>true</server>
</ntp>
ps axf|grep ntpd
killall ntpd
ps axf|grep ntpd
php -f /direct-usb/fvdw/cron-boot/restart-sync-ntp-daemon.phpps axf|grep ntpd
I think there is an issue with the current max running Time value which aborts the script if you use this sleep value. I go to check what is thé current value.I just have to add that once a while my server gets the good date and time. I don't know if it's due to the script (I've put a 300 sleep) or just that the restart of the fiber box is quick enough.
<?php
require_once("/etc/inc/global_defs.inc");
require_once("/etc/inc/globals.inc");
require_once("/etc/finc/logError.finc");
require_once("/etc/finc/configfunc_read.finc");
require_once("/etc/finc/ntpfunc_daemon_ntp_kill.finc");
require_once("/etc/finc/ntpfunc_daemon_start.finc");
#Reset running configuration
set_time_limit(0);
$config = "";
$volatileConfig = "";
if (($rc= configfunc_read($config, $volatileConfig)) != OK_E){
logError(__FILE__, __LINE__ , "nasapi: Error reading conf files. err num = {$rc}", LOG_WARNING);
return $rc;
}
# kill all orphan daemon
ntpfunc_daemon_ntp_kill();
$config['system']['ntp']['enable'] = "true";
# Custom a delay in seconds before starting ntp daemon
sleep(300);
$rc = ntpfunc_daemon_start();
if ($rc != OK_E){
logError(__FILE__, __LINE__ , "ntpfunc_ntp_start, err= {$rc}", LOG_WARNING);
return FAIL_E;
}
return OK_E;
?>

ps axf |grep ntpd| grep -v 'grep'
date
killall ntpd
date -s 2019.01.01-12:00
date
debugon
php -f /direct-usb/fvdw/cron-boot/restart-sync-ntp-daemon.php
debugoff
cat /var/log/messages
ps axf |grep ntpd| grep -v 'grep'
(wait around 1min or repeat date command up to date is updated)
date

Return to Lacie cloudbox (white casing)
Users browsing this forum: No registered users and 11 guests