mirror of
https://github.com/DominicBreuker/pspy.git
synced 2025-12-21 11:44:51 +00:00
switch to dep and integrate cobra
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user