aggiunta l'opzione per il nome del pidfile

This commit is contained in:
Miki 2016-05-16 16:12:16 +02:00
parent e968c82c21
commit 803780ff28
2 changed files with 10 additions and 6 deletions

View file

@ -15,11 +15,6 @@ const (
)
var (
opts = Options{
RedisTTL: time.Hour * 11688, // 16 mesi
LogFile: "log/llmongo.log",
}
loop []bool
done []chan bool
@ -59,7 +54,7 @@ func main() {
log.SetOutput(fs)
// DA VERIFICARE
pid.PIDFile = opts.Pidfile
pid.Write(true)
defer pid.Remove()

View file

@ -28,8 +28,16 @@ type Options struct {
Influxdb string
Hostname string
Month string
Pidfile string
}
var (
opts = Options{
RedisTTL: time.Hour * 11688, // 16 mesi
LogFile: "log/llmongo.log",
}
)
func usage() {
fmt.Println("Usage: llmongo -m <mongo uri> -r <redis uri> -t <redis keys ttl> -l <logfile> -b <concurrent thread> -T <running ttl> -x <xymon server> -H <hostname> -i <influxdb uri> -v\n")
os.Exit(0)
@ -59,4 +67,5 @@ func init() {
flag.BoolVar(&opts.Debug, "D", false, "Debug")
flag.IntVar(&opts.Concurrent, "c", 1, "Concurrent thread")
flag.IntVar(&opts.MaxError, "E", 100, "Max Mongodb Error")
flag.StringVar(&opts.Pidfile, "p", opts.Pidfile, "pid file")
}