mirror of
https://github.com/eosswedenorg/antelope-api-healthcheck
synced 2026-07-04 12:03:43 +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"
|
"strings"
|
||||||
"strconv"
|
"strconv"
|
||||||
"./log"
|
"./log"
|
||||||
|
"./pid"
|
||||||
"./haproxy"
|
"./haproxy"
|
||||||
"./eosapi"
|
"./eosapi"
|
||||||
"github.com/firstrow/tcp_server"
|
"github.com/firstrow/tcp_server"
|
||||||
|
|
@ -116,8 +117,14 @@ func main() {
|
||||||
getopt.FlagLong(&pidFile, "pid", 'p', "Path to pid file", "file")
|
getopt.FlagLong(&pidFile, "pid", 'p', "Path to pid file", "file")
|
||||||
getopt.Parse()
|
getopt.Parse()
|
||||||
|
|
||||||
|
log.Info("Process is starting with PID: %d", pid.Get())
|
||||||
|
|
||||||
if len(pidFile) > 0 {
|
if len(pidFile) > 0 {
|
||||||
log.Info("Writing pidfile: %s", pidFile)
|
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())
|
server := tcp_server.New(argv_listen_addr())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue