mirror of
https://github.com/eosswedenorg/antelope-api-healthcheck
synced 2026-06-17 04:50:02 +02:00
src/server.go: Use pid package and write pid file.
This commit is contained in:
parent
060535f595
commit
e0c7cfcc62
1 changed files with 7 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import (
|
|||
"strings"
|
||||
"strconv"
|
||||
"./log"
|
||||
"./pid"
|
||||
"./haproxy"
|
||||
"./eosapi"
|
||||
"github.com/firstrow/tcp_server"
|
||||
|
|
@ -116,8 +117,14 @@ func main() {
|
|||
getopt.FlagLong(&pidFile, "pid", 'p', "Path to pid file", "file")
|
||||
getopt.Parse()
|
||||
|
||||
log.Info("Process is starting with PID: %d", pid.Get())
|
||||
|
||||
if len(pidFile) > 0 {
|
||||
log.Info("Writing pidfile: %s", pidFile)
|
||||
_, err := pid.Save(pidFile)
|
||||
if err != nil {
|
||||
log.Error("Failed to write pidfile: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
server := tcp_server.New(argv_listen_addr())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue