Merge pull request 'Исправлен баг с остановкой ntp' (#7) from develop into master

Reviewed-on: Igor1/ubl-settings-datetime#7
pull/31/head
Igor Belitskiy 3 years ago
commit 387ebde6a1

@ -290,19 +290,14 @@ void MainWindow::wind_close_ntp(){
void MainWindow::stop_ntp(){
windowsNnpClose->hide();
string cmd = "";
string response = "";
string array_servis[8] = {"systemd-timesyncd", "chronyd.service", "ntp.service", "ntpdate.service",
"ntpd.service", "ptp4l.service", "openntpd.service", "phc2sys.service"};
for (string &name_serive: array_servis){
cmd = "systemctl status " + name_serive + " | grep \"Active: active\"";
response = this->call(cmd.c_str());
if (response.length()!=0){
cmd = "systemctl --quiet is-active " + name_serive + " &>/dev/null && systemctl stop " + name_serive;
this->call(cmd.c_str());
}
}
string cmd = "SEL_SERVICE=\"systemd-timesyncd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service; "
"SEL_SERVICE=\"ntpd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; "
"SEL_SERVICE=\"ntpdate\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; "
"SEL_SERVICE=\"chronyd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; "
"SEL_SERVICE=\"openntpd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ntpd; "
"SEL_SERVICE=\"ptp4l\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; "
"SEL_SERVICE=\"phc2sys\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE} ";
system(cmd.c_str());
this->update_time_date();

Loading…
Cancel
Save