|
|
|
@ -2113,7 +2113,9 @@ void start_ntpd(void)
|
|
|
|
|
{
|
|
|
|
|
FILE *f;
|
|
|
|
|
char *servers, *ptr;
|
|
|
|
|
int servers_len = 0, ntp_updates_int = 0, ret;
|
|
|
|
|
int servers_len = 0, ntp_updates_int = 0, index = 2, ret;
|
|
|
|
|
char *ntpd_argv[] = { "/usr/sbin/ntpd", "-t", NULL, NULL, NULL, NULL };
|
|
|
|
|
pid_t pid;
|
|
|
|
|
|
|
|
|
|
if (getpid() != 1) {
|
|
|
|
|
start_service("ntpd");
|
|
|
|
@ -2163,15 +2165,20 @@ void start_ntpd(void)
|
|
|
|
|
|
|
|
|
|
free(servers);
|
|
|
|
|
|
|
|
|
|
if (nvram_contains_word("log_events", "ntp")) /* add verbose (doesn't work right now) */
|
|
|
|
|
ntpd_argv[index++] = "-d6";
|
|
|
|
|
|
|
|
|
|
if (ntp_updates_int == 0) /* only at startup, then quit */
|
|
|
|
|
eval("/usr/sbin/ntpd", "-q", "-t");
|
|
|
|
|
ntpd_argv[index++] = "-q";
|
|
|
|
|
else if (ntp_updates_int >= 1) { /* auto adjusted timing by ntpd since it doesn't currently implement minpoll and maxpoll */
|
|
|
|
|
if (nvram_get_int("ntpd_enable"))
|
|
|
|
|
ret = eval("/usr/sbin/ntpd", "-l", "-t", "-S", "/sbin/ntpd_synced", nvram_contains_word("log_events", "ntp") ? "-d6" : NULL);
|
|
|
|
|
else
|
|
|
|
|
ret = eval("/usr/sbin/ntpd", "-t", "-S", "/sbin/ntpd_synced", nvram_contains_word("log_events", "ntp") ? "-d6" : NULL);
|
|
|
|
|
ntpd_argv[index++] = "-S";
|
|
|
|
|
ntpd_argv[index++] = "/sbin/ntpd_synced";
|
|
|
|
|
|
|
|
|
|
if (nvram_get_int("ntpd_enable")) /* enable local NTP server */
|
|
|
|
|
ntpd_argv[index++] = "-l";
|
|
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
|
ret = _eval(ntpd_argv, NULL, 0, &pid);
|
|
|
|
|
if (ret == 0)
|
|
|
|
|
logmsg(LOG_INFO, "ntpd is started");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|