Merge branch 'master' of github.com:trueos/sysadm

This commit is contained in:
Mrt134
2016-09-13 13:03:53 -04:00
2 changed files with 6 additions and 8 deletions

View File

@@ -148,8 +148,7 @@ bool Firewall::IsRunning()
}
bool Firewall::IsEnabled(){
ServiceManager serviceManager;
return serviceManager.isEnabled( serviceManager.GetService("ipfw") );
return (0 == system("sysrc -c firewall_enable=\"YES\"") );
}
void Firewall::Start()
@@ -256,10 +255,9 @@ void Firewall::SaveOpenPorts(QList<PortInfo> openports)
file.close();
}
//Re-load/start rules (just in case - it is a smart script)
if(IsRunning())
{
QStringList args;
if(IsRunning()){ Restart(); }
/* QStringList args;
args << "/usr/local/share/pcbsd/scripts/reset-firewall";
General::RunCommand("sh",args);
}
}*/
}

View File

@@ -257,7 +257,7 @@ QJsonObject SysMgmt::memoryStats() {
QJsonObject SysMgmt::procInfo() {
QJsonObject retObject;
QStringList output;
output = General::RunCommand("top -t -n all").split("\n");
output = General::RunCommand("top -t -n -a all").split("\n");
bool inSection = false;
for(int i=0; i<output.length(); i++){
if (output.at(i).contains("PID") && output.at(i).contains("USERNAME")){
@@ -283,7 +283,7 @@ QJsonObject SysMgmt::procInfo() {
values.insert("cpu", line.section(" ", 8, 8));
values.insert("time", line.section(" ", 9, 9));
values.insert("wcpu", line.section(" ", 10, 10));
values.insert("command", line.section(" ", 11, 11));
values.insert("command", line.section(" ", 11, -1));
// Add the PID object
retObject.insert(pid, values);