mirror of https://github.com/nealey/spongy
Collectly handle restarts
This commit is contained in:
parent
8e297e9bf1
commit
ab7701eae0
10
Makefile
10
Makefile
|
@ -6,8 +6,14 @@ ICONS += app/icon-256.png
|
||||||
|
|
||||||
all: icons serverside
|
all: icons serverside
|
||||||
|
|
||||||
serverside:
|
serverside: spongy spongy.cgi
|
||||||
GOPATH=$(CURDIR) go build -v all
|
|
||||||
|
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)
|
icons: $(ICONS)
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ func tail(w http.ResponseWriter, filename string, pos int64) {
|
||||||
parts := strings.Split(t, " ")
|
parts := strings.Split(t, " ")
|
||||||
if (len(parts) >= 4) && (parts[2] == "NEXTLOG") {
|
if (len(parts) >= 4) && (parts[2] == "NEXTLOG") {
|
||||||
watcher.Remove(filepath)
|
watcher.Remove(filepath)
|
||||||
filename = parts[4]
|
filename = parts[3]
|
||||||
filepath = path.Join(NetworkDir, filename)
|
filepath = path.Join(NetworkDir, filename)
|
||||||
f.Close()
|
f.Close()
|
||||||
f, err = os.Open(filepath)
|
f, err = os.Open(filepath)
|
||||||
|
@ -83,6 +83,7 @@ func tail(w http.ResponseWriter, filename string, pos int64) {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
watcher.Add(filepath)
|
watcher.Add(filepath)
|
||||||
|
pos = 0
|
||||||
}
|
}
|
||||||
fmt.Fprintf(w, "data: %s\n", t)
|
fmt.Fprintf(w, "data: %s\n", t)
|
||||||
printid = true
|
printid = true
|
||||||
|
|
Loading…
Reference in New Issue