diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..58bce9c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.log +*.pid \ No newline at end of file diff --git a/main.go b/main.go new file mode 100644 index 0000000..c7a948e --- /dev/null +++ b/main.go @@ -0,0 +1,33 @@ +package main + +import ( + "github.com/sevlyar/go-daemon" + "gitlab.com/saburly/kiviscraplib/workerclient" + "log" +) + +func main() { + cntxt := &daemon.Context{ + PidFileName: "sample.pid", + PidFilePerm: 0644, + LogFileName: "sample.log", + LogFilePerm: 0640, + WorkDir: "./", + Umask: 027, + Args: []string{"[kivi scraping worker client]"}, + } + + d, err := cntxt.Reborn() + if err != nil { + log.Fatal("Unable to run: ", err) + } + if d != nil { + return + } + // TODO: Handle error + defer cntxt.Release() + + go workerclient.StartClientConnections() + + select {} // Wait forever +}