aggiunta l'opzione per specificare il database di destinazione
This commit is contained in:
parent
8dca30619b
commit
2778e5506b
3 changed files with 6 additions and 3 deletions
2
dbs.go
2
dbs.go
|
@ -78,6 +78,6 @@ func connectMongo() {
|
||||||
log.Println("Mongodb connect Error: ", err.Error())
|
log.Println("Mongodb connect Error: ", err.Error())
|
||||||
os.Exit(-3)
|
os.Exit(-3)
|
||||||
}
|
}
|
||||||
dbs.lc = dbs.mdbDst.DB("dovecot").C("lastlogin_day")
|
dbs.lc = dbs.mdbDst.DB(opts.DstDB).C("lastlogin_day")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
_VERSION = "v1.3.6"
|
_VERSION = "v1.3.7"
|
||||||
_tformat = "2006-01-02"
|
_tformat = "2006-01-02"
|
||||||
_24h = (time.Hour * 23) + (time.Minute * 59) + (time.Second * 59) + (time.Millisecond * 999)
|
_24h = (time.Hour * 23) + (time.Minute * 59) + (time.Second * 59) + (time.Millisecond * 999)
|
||||||
_10m = (time.Minute * 10)
|
_10m = (time.Minute * 10)
|
||||||
|
@ -28,6 +28,7 @@ var (
|
||||||
Duration: _24h,
|
Duration: _24h,
|
||||||
Interval: _15m,
|
Interval: _15m,
|
||||||
Batch: 10000,
|
Batch: 10000,
|
||||||
|
DstDB: "dovecot",
|
||||||
}
|
}
|
||||||
|
|
||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
|
|
|
@ -15,6 +15,7 @@ import (
|
||||||
type Options struct {
|
type Options struct {
|
||||||
MongoSrc string
|
MongoSrc string
|
||||||
MongoDst string
|
MongoDst string
|
||||||
|
DstDB string
|
||||||
StartDate string
|
StartDate string
|
||||||
Duration time.Duration
|
Duration time.Duration
|
||||||
Interval time.Duration
|
Interval time.Duration
|
||||||
|
@ -43,11 +44,12 @@ func init() {
|
||||||
|
|
||||||
flag.StringVar(&opts.MongoSrc, "ms", opts.MongoSrc, "Mongodb Source")
|
flag.StringVar(&opts.MongoSrc, "ms", opts.MongoSrc, "Mongodb Source")
|
||||||
flag.StringVar(&opts.MongoDst, "md", "", "Mongodb Destination")
|
flag.StringVar(&opts.MongoDst, "md", "", "Mongodb Destination")
|
||||||
|
flag.StringVar(&opts.MongoDst, "dd", opts.DstDB, "Database Destination")
|
||||||
flag.StringVar(&opts.Influxdb, "I", "", "Influxdb uri")
|
flag.StringVar(&opts.Influxdb, "I", "", "Influxdb uri")
|
||||||
flag.StringVar(&opts.Hostname, "H", "", "Hostname")
|
flag.StringVar(&opts.Hostname, "H", "", "Hostname")
|
||||||
flag.StringVar(&opts.LogFile, "l", opts.LogFile, "Logs filename")
|
flag.StringVar(&opts.LogFile, "l", opts.LogFile, "Logs filename")
|
||||||
flag.StringVar(&opts.StartDate, "d", opts.StartDate, "Date")
|
flag.StringVar(&opts.StartDate, "d", opts.StartDate, "Date")
|
||||||
flag.DurationVar(&opts.Duration, "dd", opts.Duration, "Duration")
|
flag.DurationVar(&opts.Duration, "du", opts.Duration, "Duration")
|
||||||
flag.DurationVar(&opts.Interval, "i", opts.Interval, "Duration")
|
flag.DurationVar(&opts.Interval, "i", opts.Interval, "Duration")
|
||||||
flag.BoolVar(&opts.Version, "v", false, "Version")
|
flag.BoolVar(&opts.Version, "v", false, "Version")
|
||||||
flag.BoolVar(&opts.Debug, "debug", false, "Debug")
|
flag.BoolVar(&opts.Debug, "debug", false, "Debug")
|
||||||
|
|
Loading…
Add table
Reference in a new issue