Skip to content

Commit

Permalink
Adds init.d support to Linux Service Collector (#73)
Browse files Browse the repository at this point in the history
Now check init.d on linux
  • Loading branch information
gfs committed Apr 5, 2019
1 parent 1cc42f5 commit a879d40
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions Lib/Collectors/Service/ServiceCollector.cs
Expand Up @@ -196,12 +196,29 @@ public override void Execute()

Write(obj);
}
}

result = runner.RunExternalCommand("ls", "/etc/init.d/ -l");

lines = result.Split('\n');
lines.ToList().RemoveAt(0);

foreach (var _line in lines)
{
var _fields = _line.Split('\t');
var obj = new ServiceObject()
{
DisplayName = _fields[8],
ServiceName = _fields[8],
StartType = "Unknown",
CurrentState = "Unknown"
};

Write(obj);
}

// without systemd (maybe just CentOS)
// chkconfig --list
// look at init.d?

// BSD
// service -l
Expand Down

0 comments on commit a879d40

Please sign in to comment.