eliminata la gestione del PID non piu' necessaria con Docker

This commit is contained in:
Michele 2017-04-07 10:04:26 +02:00
parent ae82c15f70
commit 6896b447c5
6 changed files with 13 additions and 11 deletions

View file

@ -3,6 +3,6 @@ FROM scratch
MAINTAINER Michele Fadda "<mikif70@gmail.com>" MAINTAINER Michele Fadda "<mikif70@gmail.com>"
COPY lastlogin_mongodb-v4.1.1 /bin/lastlogin_mongodb COPY lastlogin_mongodb-v4.2.0 /bin/lastlogin_mongodb
ENTRYPOINT [ "/bin/lastlogin_mongodb" ] ENTRYPOINT [ "/bin/lastlogin_mongodb" ]

View file

@ -6,7 +6,7 @@ docker run \
--name llmongo_tiscali \ --name llmongo_tiscali \
--log-opt max-size=2m \ --log-opt max-size=2m \
--log-opt max-file=5 \ --log-opt max-file=5 \
mikif70/llmongo:4.1.1 \ mikif70/llmongo:4.2.0 \
-l /data/llmongo.log \ -l /data/llmongo.log \
-p /data/llmongo.pid \ -p /data/llmongo.pid \
-r redis-ll.mail.tiscali.sys:6379 \ -r redis-ll.mail.tiscali.sys:6379 \

0
build.sh Normal file → Executable file
View file

View file

@ -12,7 +12,7 @@ import (
) )
const ( const (
_Version = "v4.1.1" _Version = "v4.2.0"
_Producer = 0 _Producer = 0
_Consumer = 1 _Consumer = 1
_Remover = 2 _Remover = 2
@ -70,9 +70,9 @@ func main() {
log.SetOutput(fs) log.SetOutput(fs)
pid.PIDFile = opts.Pidfile // pid.PIDFile = opts.Pidfile
pid.Write(true) // pid.Write(true)
defer pid.Remove() // defer pid.Remove()
start := time.Now() start := time.Now()
fmt.Printf("Start: %+v\n", opts) fmt.Printf("Start: %+v\n", opts)

View file

@ -25,7 +25,7 @@ type Options struct {
MaxError int MaxError int
Influxdb string Influxdb string
Month string Month string
Pidfile string // Pidfile string
Queue int Queue int
} }
@ -61,7 +61,7 @@ func init() {
} }
opts.LogFile = path.Join(opts.CurrentPath, opts.LogFile) opts.LogFile = path.Join(opts.CurrentPath, opts.LogFile)
opts.Pidfile = path.Join(opts.CurrentPath, "run", path.Base(os.Args[0])+".pid") // opts.Pidfile = path.Join(opts.CurrentPath, "run", path.Base(os.Args[0])+".pid")
opts.Exe = path.Base(os.Args[0]) opts.Exe = path.Base(os.Args[0])
flag.StringVar(&opts.Influxdb, "i", "", "influxdb server") flag.StringVar(&opts.Influxdb, "i", "", "influxdb server")
@ -76,5 +76,5 @@ func init() {
flag.BoolVar(&opts.Test, "DD", false, "Test") flag.BoolVar(&opts.Test, "DD", false, "Test")
flag.IntVar(&opts.MaxError, "E", 100, "Max Mongodb Error") flag.IntVar(&opts.MaxError, "E", 100, "Max Mongodb Error")
flag.IntVar(&opts.Queue, "q", 2, "parallel consumer") flag.IntVar(&opts.Queue, "q", 2, "parallel consumer")
flag.StringVar(&opts.Pidfile, "p", opts.Pidfile, "pid file") // flag.StringVar(&opts.Pidfile, "p", opts.Pidfile, "pid file")
} }

2
pid.go
View file

@ -1,6 +1,7 @@
// pid // pid
package main package main
/*
import ( import (
"bytes" "bytes"
"fmt" "fmt"
@ -83,3 +84,4 @@ func (p *PID) Remove() {
fmt.Println("RM file error: ", err.Error()) fmt.Println("RM file error: ", err.Error())
} }
} }
*/