Updated main.go.
This commit is contained in:
parent
ef99d71a1a
commit
68e968d712
12
main.go
12
main.go
@ -23,19 +23,19 @@ var version string
|
||||
// A process is effectively a substring that is being looked in a cmdline file
|
||||
// in /proc/ dir on unix-like systems.
|
||||
type Process struct {
|
||||
Alias string `json:"alias"`
|
||||
Process string `json:"process"`
|
||||
Alias string `json:"alias"`
|
||||
}
|
||||
|
||||
// ProcessesState is a map of processes' aliases and its statuses.
|
||||
type ProcessesState map[string]bool
|
||||
|
||||
func GetProcessesState(procs *[]Process) (ps ProcessesState) {
|
||||
ps = make(ProcessesState)
|
||||
ps = make(ProcessesState, len(*procs))
|
||||
|
||||
for _, proc := range *procs {
|
||||
pids, err := GetProcessPIDs(proc.Process)
|
||||
ps[proc.Alias] = err == nil && len(pids) > 0
|
||||
run, _ := IsProcessRuns(proc.Process)
|
||||
ps[proc.Alias] = run
|
||||
}
|
||||
|
||||
return
|
||||
@ -73,12 +73,12 @@ func LoadConfiguration(path string) (conf *Configuration, err error) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
log.SetFlags(0)
|
||||
log.SetFlags(log.Llongfile)
|
||||
flag.Parse()
|
||||
|
||||
if *showVersion {
|
||||
fmt.Fprintln(os.Stderr, "httpprocprobed ver.", version, "\nCopyright (c) 2021-2024 Alexander \"Arav\" Andreev <me@arav.su>")
|
||||
os.Exit(0)
|
||||
return
|
||||
}
|
||||
|
||||
conf, err := LoadConfiguration(*configPath)
|
||||
|
Loading…
Reference in New Issue
Block a user