Commit 595d119c authored by Nico Baruna Putra's avatar Nico Baruna Putra

remove read file funciton

parent 5b750d06
......@@ -7,10 +7,8 @@ import (
"log"
"net/http"
"os/exec"
"strings"
"time"
"github.com/hpcloud/tail"
"gopkg.in/gomail.v2"
)
......@@ -102,30 +100,3 @@ func Native() {
fmt.Println("--- stderr ---")
fmt.Println(errout)
}
func readFile(fname string) {
t, err := tail.TailFile(MYFILE, tail.Config{Follow: true, Poll: true, ReOpen: true, MaxLineSize: 250})
flag := 0
if err == nil {
for line := range t.Lines {
fmt.Println("==NEW line detected==")
fmt.Println(line.Text)
if strings.Contains(line.Text, KEYWORD) {
fmt.Println("ERROR FOUND")
if flag == 1 {
Native()
sendMail(line.Text)
}
}
fmt.Println("end")
}
flag++
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment