switch to dep and integrate cobra

This commit is contained in:
Dominic Breuker
2018-02-13 10:00:38 +01:00
parent 56f706b7e2
commit c92dd9992f
88 changed files with 12470 additions and 2288 deletions

View File

@@ -30,6 +30,10 @@ func NewInotify(ping chan struct{}) (*Inotify, error) {
return i, nil
}
func (i *Inotify) Start() {
go watch(i)
}
func (i *Inotify) Watch(dir string) error {
w, err := newWatcher(i.fd, dir, i.ping)
if err != nil {

View File

@@ -1,4 +1,4 @@
package cmd
package pspy
import (
"log"
@@ -12,10 +12,10 @@ import (
const MaxInt = int(^uint(0) >> 1)
func Monitor() {
watch([]string{"/tmp"}, nil)
Watch([]string{"/tmp"}, nil, true, true)
}
func watch(rdirs, dirs []string) {
func Watch(rdirs, dirs []string, logPS, logFS bool) {
maxWatchers, err := inotify.WatcherLimit()
if err != nil {
log.Printf("Can't get inotify watcher limit...: %v\n", err)
@@ -36,7 +36,7 @@ func watch(rdirs, dirs []string) {
addWatchers(dir, 0, in, maxWatchers)
}
log.Printf("Inotify watchers set up: %s\n", in)
log.Printf("Inotify watchers set up: %s - watching now\n", in)
procList := process.NewProcList()