Collectly handle restarts

This commit is contained in:
Neale Pickett 2015-01-29 20:44:28 +00:00
parent 8e297e9bf1
commit ab7701eae0
2 changed files with 10 additions and 3 deletions

View File

@ -6,8 +6,14 @@ ICONS += app/icon-256.png
all: icons serverside
serverside:
GOPATH=$(CURDIR) go build -v all
serverside: spongy spongy.cgi
spongy: src/spongy/spongy.go
GOPATH=$(CURDIR) go build -v $@
spongy.cgi: src/spongy.cgi/spongy.cgi.go
GOPATH=$(CURDIR) go build -v $@
chmod +s $@
icons: $(ICONS)

View File

@ -75,7 +75,7 @@ func tail(w http.ResponseWriter, filename string, pos int64) {
parts := strings.Split(t, " ")
if (len(parts) >= 4) && (parts[2] == "NEXTLOG") {
watcher.Remove(filepath)
filename = parts[4]
filename = parts[3]
filepath = path.Join(NetworkDir, filename)
f.Close()
f, err = os.Open(filepath)
@ -83,6 +83,7 @@ func tail(w http.ResponseWriter, filename string, pos int64) {
log.Fatal(err)
}
watcher.Add(filepath)
pos = 0
}
fmt.Fprintf(w, "data: %s\n", t)
printid = true