mirror of
https://github.com/outbackdingo/sysadm.git
synced 2026-01-27 18:20:23 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user