From 1b1736a2e44ff94f3d76a584161a42b044c9c6d1 Mon Sep 17 00:00:00 2001 From: Miki Date: Thu, 21 Apr 2016 16:21:13 +0200 Subject: [PATCH] aggiunta gestione del PID --- lastlogin_consolidate.go | 9 ++++++++- options.go | 26 ++++++++++++++------------ 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/lastlogin_consolidate.go b/lastlogin_consolidate.go index ff2adaf..1e70e7a 100644 --- a/lastlogin_consolidate.go +++ b/lastlogin_consolidate.go @@ -12,7 +12,7 @@ import ( ) const ( - _VERSION = "v1.3.1" + _VERSION = "v1.3.2" _tformat = "2006-01-02" _24h = (time.Hour * 23) + (time.Minute * 59) + (time.Second * 59) _10m = (time.Minute * 10) @@ -29,6 +29,8 @@ var ( Batch: 10000, } + loop []bool + dbs = Dbs{} idb = InfluxdbOutput{ @@ -57,6 +59,8 @@ func main() { } } + setTerm() + fs, err := os.OpenFile(opts.LogFile, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0666) if err != nil { fmt.Println("Log file error: ", err.Error()) @@ -65,6 +69,9 @@ func main() { log.SetOutput(fs) + pid.Write(true) + defer pid.Remove() + start := time.Now() fmt.Printf("Start: %+v\n", opts) log.Printf("Start: %+v\n", opts) diff --git a/options.go b/options.go index e696e42..296853c 100644 --- a/options.go +++ b/options.go @@ -13,18 +13,20 @@ import ( ) type Options struct { - MongoSrc string - MongoDst string - StartDate string - Duration time.Duration - Interval time.Duration - LogFile string - Influxdb string - Hostname string - Version bool - Debug bool - Bulk bool - Batch int + MongoSrc string + MongoDst string + StartDate string + Duration time.Duration + Interval time.Duration + LogFile string + Influxdb string + Hostname string + Version bool + Debug bool + Bulk bool + Batch int + Exe string + Concurrent int } func usage() {