aggiunta gestione del PID
This commit is contained in:
parent
2e53d3fb4f
commit
1b1736a2e4
2 changed files with 22 additions and 13 deletions
|
@ -12,7 +12,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
_VERSION = "v1.3.1"
|
_VERSION = "v1.3.2"
|
||||||
_tformat = "2006-01-02"
|
_tformat = "2006-01-02"
|
||||||
_24h = (time.Hour * 23) + (time.Minute * 59) + (time.Second * 59)
|
_24h = (time.Hour * 23) + (time.Minute * 59) + (time.Second * 59)
|
||||||
_10m = (time.Minute * 10)
|
_10m = (time.Minute * 10)
|
||||||
|
@ -29,6 +29,8 @@ var (
|
||||||
Batch: 10000,
|
Batch: 10000,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loop []bool
|
||||||
|
|
||||||
dbs = Dbs{}
|
dbs = Dbs{}
|
||||||
|
|
||||||
idb = InfluxdbOutput{
|
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)
|
fs, err := os.OpenFile(opts.LogFile, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Log file error: ", err.Error())
|
fmt.Println("Log file error: ", err.Error())
|
||||||
|
@ -65,6 +69,9 @@ func main() {
|
||||||
|
|
||||||
log.SetOutput(fs)
|
log.SetOutput(fs)
|
||||||
|
|
||||||
|
pid.Write(true)
|
||||||
|
defer pid.Remove()
|
||||||
|
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
fmt.Printf("Start: %+v\n", opts)
|
fmt.Printf("Start: %+v\n", opts)
|
||||||
log.Printf("Start: %+v\n", opts)
|
log.Printf("Start: %+v\n", opts)
|
||||||
|
|
26
options.go
26
options.go
|
@ -13,18 +13,20 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Options struct {
|
type Options struct {
|
||||||
MongoSrc string
|
MongoSrc string
|
||||||
MongoDst string
|
MongoDst string
|
||||||
StartDate string
|
StartDate string
|
||||||
Duration time.Duration
|
Duration time.Duration
|
||||||
Interval time.Duration
|
Interval time.Duration
|
||||||
LogFile string
|
LogFile string
|
||||||
Influxdb string
|
Influxdb string
|
||||||
Hostname string
|
Hostname string
|
||||||
Version bool
|
Version bool
|
||||||
Debug bool
|
Debug bool
|
||||||
Bulk bool
|
Bulk bool
|
||||||
Batch int
|
Batch int
|
||||||
|
Exe string
|
||||||
|
Concurrent int
|
||||||
}
|
}
|
||||||
|
|
||||||
func usage() {
|
func usage() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue