diff --git a/include/botui/Create3Widget.h b/include/botui/Create3Widget.h index 1f9af6bf..57a9a8e6 100644 --- a/include/botui/Create3Widget.h +++ b/include/botui/Create3Widget.h @@ -39,8 +39,7 @@ private slots: int m_position_1; double m_vel_1; - QProcess *podmanStop; - QProcess *podmanStart; + QProcess *create3ServerService; }; diff --git a/src/Create3Widget.cpp b/src/Create3Widget.cpp index b618b69b..55e67080 100644 --- a/src/Create3Widget.cpp +++ b/src/Create3Widget.cpp @@ -42,9 +42,7 @@ Create3Widget::Create3Widget(Device *device, QWidget *parent) connect(ui->Create3SensorListButton, SIGNAL(clicked()), SLOT(sensorList())); connect(ui->Create3ExampleProgramButton, SIGNAL(clicked()), SLOT(exampleList())); - podmanStop = new QProcess(this); - podmanStart = new QProcess(this); - + create3ServerService = new QProcess(this); ui->create3IP->setText(getIP()); } @@ -117,58 +115,25 @@ int Create3Widget::isConnected() void Create3Widget::resetServer() { - QString podmanStopCommand = "sudo"; - QStringList podmanStopArgs = { - "podman", - "stop", - "-a" - }; - - connect(podmanStop, &QProcess::readyReadStandardOutput, [=]() { - QByteArray data = podmanStop->readAllStandardOutput(); - qDebug() << "Output:" << data; - }); - - connect(podmanStop, &QProcess::readyReadStandardError, [=]() { - QByteArray data = podmanStop->readAllStandardError(); - qDebug() << "Error:" << data; - }); - - podmanStop->start(podmanStopCommand, podmanStopArgs); - - if (podmanStop->waitForFinished()) - { - qDebug() << "Podman container successfully stopped with exit code:" << podmanStop->exitCode(); - } - else - { - qDebug() << "Podman stop failed to start or crashed."; - } - - QString podmanStartCommand = "sudo"; - QStringList podmanStartArgs = { - "podman", - "run", - "-dt", - "--rm", - "--net=host", - "--env", - "IP=192.168.125.1", - "docker.io/kipradmin/create3_docker" + QString restartCommand = "sudo"; + QStringList restartArgs = { + "systemctl", + "restart", + "create3_server.service" }; - connect(podmanStart, &QProcess::readyReadStandardError, [=]() { - QByteArray data = podmanStart->readAllStandardError(); + connect(create3ServerService, &QProcess::readyReadStandardError, [=]() { + QByteArray data = create3ServerService->readAllStandardError(); qDebug() << "Error:" << data; }); - if (podmanStart->startDetached(podmanStartCommand, podmanStartArgs)) + if (create3ServerService->startDetached(restartCommand, restartArgs)) { - qDebug() << "Podman container successfully started and detached"; + qDebug() << "Create3 Server successfully restarted and detached"; } else { - qDebug() << "Podman container failed to start or crashed."; + qDebug() << "Create3 Server failed to restart or crashed."; } }