Исправлена остановка Ntp

pull/30/head^2
Igor Belitskiy 3 years ago
parent 14da69148a
commit fd3d51f029

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

Loading…
Cancel
Save