Clean up the new sysadm/services class just a bit more. Getting ready to add all the start/stop/restart API calls.

This commit is contained in:
Ken Moore
2016-08-29 16:09:30 -04:00
parent 0d4eb2c4f3
commit ce86331f1e
3 changed files with 13 additions and 10 deletions

View File

@@ -1020,6 +1020,9 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmServiceRequest(const QJsonVa
ok = true;
out->insert("services",services);
}
if(out->keys().isEmpty()){
if(ok){ out->insert("result","success"); }
else{ out->insert("error","error");
}
return (ok ? RestOutputStruct::OK : RestOutputStruct::BADREQUEST);
}

View File

@@ -65,7 +65,7 @@ bool ServiceManager::isEnabled(Service service){ //single-item overload
else{ return false; }
}
void ServiceManager::Start(Service service)
bool ServiceManager::Start(Service service)
{
// Start the process
QString prog;
@@ -79,10 +79,10 @@ void ServiceManager::Start(Service service)
prog = "warden";
args << "chroot" << ip << "service" << service.Directory << (once ? "one" : "" )+QString("start");
}
General::RunCommand(prog,args);
return General::RunQuickCommand(prog,args);
}
void ServiceManager::Stop(Service service)
bool ServiceManager::Stop(Service service)
{
// Start the process
QString prog;
@@ -96,10 +96,10 @@ void ServiceManager::Stop(Service service)
prog = "warden";
args << "chroot" << ip << "service" << service.Directory << (once ? "one" : "" )+QString("stop");
}
General::RunCommand(prog,args);
return General::RunQuickCommand(prog,args);
}
void ServiceManager::Restart(Service service)
bool ServiceManager::Restart(Service service)
{
QString prog;
QStringList args;
@@ -112,7 +112,7 @@ void ServiceManager::Restart(Service service)
prog = "warden";
args << "chroot" << ip << "service" << service.Directory << (once ? "one" : "" )+QString("restart");
}
General::RunCommand(prog,args);
return General::RunQuickCommand(prog,args);
}
void ServiceManager::Enable(Service service)

View File

@@ -53,17 +53,17 @@ public:
* @brief Start starts a service
* @param service the service to start
*/
void Start(Service service);
bool Start(Service service);
/**
* @brief Stop stops a service
* @param service the service to stop
*/
void Stop(Service service);
bool Stop(Service service);
/**
* @brief Restart restarts a service
* @param service the service to restart
*/
void Restart(Service service);
bool Restart(Service service);
/**
* @brief Enable enable a service